/*! HOLLYSYS 版权所有，翻版必究 */ ! function (t) {
  var e = {};

  function o(i) {
    if (e[i]) return e[i].exports;
    var n = e[i] = {
      i: i,
      l: !1,
      exports: {}
    };
    return t[i].call(n.exports, n, n.exports, o), n.l = !0, n.exports
  }
  o.m = t, o.c = e, o.d = function (t, e, i) {
    o.o(t, e) || Object.defineProperty(t, e, {
      enumerable: !0,
      get: i
    })
  }, o.r = function (t) {
    "undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(t, Symbol.toStringTag, {
      value: "Module"
    }), Object.defineProperty(t, "__esModule", {
      value: !0
    })
  }, o.t = function (t, e) {
    if (1 & e && (t = o(t)), 8 & e) return t;
    if (4 & e && "object" == typeof t && t && t.__esModule) return t;
    var i = Object.create(null);
    if (o.r(i), Object.defineProperty(i, "default", {
        enumerable: !0,
        value: t
      }), 2 & e && "string" != typeof t)
      for (var n in t) o.d(i, n, function (e) {
        return t[e]
      }.bind(null, n));
    return i
  }, o.n = function (t) {
    var e = t && t.__esModule ? function () {
      return t.default
    } : function () {
      return t
    };
    return o.d(e, "a", e), e
  }, o.o = function (t, e) {
    return Object.prototype.hasOwnProperty.call(t, e)
  }, o.p = "", o(o.s = 108)
}({
  108: function (t, e, o) {
    o(109), o(110), o(111), o(112), o(113), o(114)
  },
  109: function (t, e, o) {
    ! function (e, o, i) {
      "use strict";
      "object" == typeof t.exports ? t.exports = function (t, e) {
        return i(t, e)
      } : i(e, o)
    }("undefined" != typeof window ? window.jQuery : {}, "undefined" != typeof window ? window : this, (function (t, e) {
      "use strict";
      var o, i = e.document,
        n = e.Image,
        a = e.Array,
        s = e.getComputedStyle,
        r = e.Math,
        l = e.Number,
        h = e.parseFloat,
        d = t.extend,
        f = t.inArray,
        c = function (t) {
          return Object.prototype.toString.call(t).slice(8, -1).toLowerCase()
        },
        u = t.isPlainObject,
        g = r.PI,
        w = r.round,
        y = r.abs,
        x = r.sin,
        p = r.cos,
        m = r.atan2,
        v = a.prototype.slice,
        T = t.event.fix,
        b = {},
        I = {
          dataCache: {},
          propCache: {},
          imageCache: {}
        },
        N = {
          rotate: 0,
          scaleX: 1,
          scaleY: 1,
          translateX: 0,
          translateY: 0,
          masks: []
        },
        k = {},
        M = ["mousedown", "mousemove", "mouseup", "mouseover", "mouseout", "touchstart", "touchmove", "touchend"];

      function C(t) {
        var e;
        for (e in t) Object.prototype.hasOwnProperty.call(t, e) && (this[e] = t[e]);
        return this
      }
      var E, L = {
        events: {},
        eventHooks: {},
        future: {}
      };

      function S() {
        d(this, S.baseDefaults)
      }

      function F(t) {
        return "string" === c(t)
      }

      function _(t) {
        return "function" === c(t)
      }

      function A(t) {
        return !isNaN(l(t)) && !isNaN(h(t))
      }

      function P(t) {
        return t && t.getContext ? t.getContext("2d") : null
      }

      function R(t) {
        var e, o;
        for (e in t) Object.prototype.hasOwnProperty.call(t, e) && (o = t[e], "string" === c(o) && A(o) && "text" !== e && (t[e] = h(o)));
        void 0 !== t.text && (t.text = String(t.text))
      }

      function O(t) {
        return (t = d({}, t)).masks = t.masks.slice(0), t
      }

      function z(t, e) {
        var o;
        t.save(), o = O(e.transforms), e.savedTransforms.push(o)
      }

      function D(t, e) {
        0 === e.savedTransforms.length ? e.transforms = O(N) : (t.restore(), e.transforms = e.savedTransforms.pop())
      }

      function J(t, e, o, i) {
        o[i] && (_(o[i]) ? e[i] = o[i].call(t, o) : e[i] = o[i])
      }

      function X(t, e, o) {
        J(t, e, o, "fillStyle"), J(t, e, o, "strokeStyle"), e.lineWidth = o.strokeWidth, o.rounded ? e.lineCap = e.lineJoin = "round" : (e.lineCap = o.strokeCap, e.lineJoin = o.strokeJoin, e.miterLimit = o.miterLimit), o.strokeDash || (o.strokeDash = []), e.setLineDash && e.setLineDash(o.strokeDash), e.webkitLineDash = o.strokeDash, e.lineDashOffset = e.webkitLineDashOffset = e.mozDashOffset = o.strokeDashOffset, e.shadowOffsetX = o.shadowX, e.shadowOffsetY = o.shadowY, e.shadowBlur = o.shadowBlur, e.shadowColor = o.shadowColor, e.globalAlpha = o.opacity, e.globalCompositeOperation = o.compositing, o.imageSmoothing && (e.imageSmoothingEnabled = o.imageSmoothing)
      }

      function Y(t, e, o) {
        o.mask && (o.autosave && z(t, e), t.clip(), e.transforms.masks.push(o._args))
      }

      function G(t, e) {
        e._transformed && t.restore()
      }

      function B(t, e, o) {
        o.closed && e.closePath(), o.shadowStroke && 0 !== o.strokeWidth ? (e.stroke(), e.fill(), e.shadowColor = "transparent", e.shadowBlur = 0, e.stroke()) : (e.fill(), "transparent" !== o.fillStyle && (e.shadowColor = "transparent"), 0 !== o.strokeWidth && e.stroke()), o.closed || e.closePath(), G(e, o), o.mask && Y(e, U(t), o)
      }

      function j(t, e, o, i, n) {
        o._toRad = o.inDegrees ? g / 180 : 1, o._transformed = !0, e.save(), o.fromCenter || o._centered || void 0 === i || (void 0 === n && (n = i), o.x += i / 2, o.y += n / 2, o._centered = !0), o.rotate && gt(e, o, null), 1 === o.scale && 1 === o.scaleX && 1 === o.scaleY || wt(e, o, null), (o.translate || o.translateX || o.translateY) && yt(e, o, null)
      }

      function U(e) {
        var o, i = I.dataCache;
        return i._canvas === e && i._data ? o = i._data : ((o = t.data(e, "jCanvas")) || (o = {
          canvas: e,
          layers: [],
          layer: {
            names: {},
            groups: {}
          },
          eventHooks: {},
          intersecting: [],
          lastIntersected: null,
          cursor: t(e).css("cursor"),
          drag: {
            layer: null,
            dragging: !1
          },
          event: {
            type: null,
            x: null,
            y: null
          },
          events: {},
          transforms: O(N),
          savedTransforms: [],
          animating: !1,
          animated: null,
          pixelRatio: 1,
          scaled: !1,
          redrawOnMousemove: !1
        }, t.data(e, "jCanvas", o)), i._canvas = e, i._data = o), o
      }

      function W(t, e, o) {
        var i;
        for (i in L.events) Object.prototype.hasOwnProperty.call(L.events, i) && (o[i] || o.cursors && o.cursors[i]) && $(t, e, o, i);
        e.events.mouseout || (t.bind("mouseout.jCanvas", (function () {
          var o, i = e.drag.layer;
          for (i && (e.drag = {}, it(t, e, i, "dragcancel")), o = 0; o < e.layers.length; o += 1)(i = e.layers[o])._hovered && t.triggerLayerEvent(e.layers[o], "mouseout");
          t.drawLayers()
        })), e.events.mouseout = !0)
      }

      function H(t, e, o, i) {
        L.events[i](t, e), o._event = !0
      }

      function $(t, e, o, i) {
        H(t, e, o, i), "mouseover" !== i && "mouseout" !== i && "mousemove" !== i || (e.redrawOnMousemove = !0)
      }

      function q(t, e, o) {
        var i, n;
        if (o.draggable || o.cursors) {
          for (i = ["mousedown", "mousemove", "mouseup"], n = 0; n < i.length; n += 1) H(t, e, o, i[n]);
          o._event = !0
        }
      }

      function K(t, e, o, i) {
        var n = e.layer.names;
        i ? void 0 !== i.name && F(o.name) && o.name !== i.name && delete n[o.name] : i = o, F(i.name) && (n[i.name] = o)
      }

      function Q(t, e, o, i) {
        var n, a, s, r, l, h = e.layer.groups;
        if (i) {
          if (void 0 !== i.groups && null !== o.groups)
            for (s = 0; s < o.groups.length; s += 1)
              if (n = h[a = o.groups[s]]) {
                for (l = 0; l < n.length; l += 1)
                  if (n[l] === o) {
                    r = l, n.splice(l, 1);
                    break
                  } 0 === n.length && delete h[a]
              }
        } else i = o;
        if (void 0 !== i.groups && null !== i.groups)
          for (s = 0; s < i.groups.length; s += 1)(n = h[a = i.groups[s]]) || ((n = h[a] = []).name = a), void 0 === r && (r = n.length), n.splice(r, 0, o)
      }

      function V(t) {
        var e, o, i;
        for (e = null, o = t.intersecting.length - 1; o >= 0; o -= 1)
          if ((e = t.intersecting[o])._masks) {
            for (i = e._masks.length - 1; i >= 0; i -= 1)
              if (!e._masks[i].intersects) {
                e.intersects = !1;
                break
              } if (e.intersects && !e.intangible) break
          } return e && e.intangible && (e = null), e
      }

      function Z(t, e, o, i) {
        o && o.visible && o._method && (o._next = i || null, o._method && o._method.call(t, o))
      }

      function tt(t, e, o) {
        var i, n, a, s, r, l, h, d, f, c;
        if (r = (n = (s = e.drag).layer) && n.dragGroups || [], i = e.layers, "mousemove" === o || "touchmove" === o) {
          if (s.dragging || (s.dragging = !0, n.dragging = !0, n.bringToFront && (i.splice(n.index, 1), n.index = i.push(n)), n._startX = n.x, n._startY = n.y, n._endX = n._eventX, n._endY = n._eventY, it(t, e, n, "dragstart")), s.dragging)
            for (f = n._eventX - (n._endX - n._startX), c = n._eventY - (n._endY - n._startY), n.updateDragX && (f = n.updateDragX.call(t[0], n, f)), n.updateDragY && (c = n.updateDragY.call(t[0], n, c)), n.dx = f - n.x, n.dy = c - n.y, "y" !== n.restrictDragToAxis && (n.x = f), "x" !== n.restrictDragToAxis && (n.y = c), it(t, e, n, "drag"), d = 0; d < r.length; d += 1)
              if (h = r[d], l = e.layer.groups[h], n.groups && l)
                for (a = 0; a < l.length; a += 1) l[a] !== n && ("y" !== n.restrictDragToAxis && "y" !== l[a].restrictDragToAxis && (l[a].x += n.dx), "x" !== n.restrictDragToAxis && "x" !== l[a].restrictDragToAxis && (l[a].y += n.dy))
        } else "mouseup" !== o && "touchend" !== o || (s.dragging && (n.dragging = !1, s.dragging = !1, e.redrawOnMousemove = e.originalRedrawOnMousemove, it(t, e, n, "dragstop")), e.drag = {})
      }

      function et(t, e) {
        t.css({
          cursor: e.cursor
        })
      }

      function ot(t, e, o, i, n) {
        i[o] && e._running && !e._running[o] && (e._running[o] = !0, i[o].call(t[0], e, n), e._running[o] = !1)
      }

      function it(e, o, i, n, a) {
        (function (e, o) {
          return !(e.disableEvents || e.intangible && -1 !== t.inArray(o, M))
        })(i, n) && ("mouseout" !== n && function (e, o, i) {
          var n;
          o.cursors && (n = o.cursors[i]), -1 !== t.inArray(n, k.cursors) && (n = k.prefix + n), n && e.css({
            cursor: n
          })
        }(e, i, n), ot(e, i, n, i, a), ot(e, i, n, o.eventHooks, a), ot(e, i, n, L.eventHooks, a))
      }

      function nt(e, o, i, n) {
        var a, s, r, l = o._layer ? i : o;
        return o._args = i, (o.draggable || o.dragGroups) && (o.layer = !0, o.draggable = !0), o._method || (n ? o._method = n : o.method ? o._method = t.fn[o.method] : o.type && (o._method = t.fn[b.drawings[o.type]])), o.layer && !o._layer ? (a = t(e), r = (s = U(e)).layers, (null === l.name || F(l.name) && void 0 === s.layer.names[l.name]) && (R(o), (l = new C(o)).canvas = e, l.layer = !0, l._layer = !0, l._running = {}, null !== l.data ? l.data = d({}, l.data) : l.data = {}, null !== l.groups ? l.groups = l.groups.slice(0) : l.groups = [], K(0, s, l), Q(0, s, l), W(a, s, l), q(a, s, l), o._event = l._event, l._method === t.fn.drawText && a.measureText(l), null === l.index && (l.index = r.length), r.splice(l.index, 0, l), o._args = l, it(a, s, l, "add"))) : o.layer || R(o), l
      }

      function at(t) {
        var e, o;
        for (o = 0; o < k.props.length; o += 1) t[e = k.props[o]] = t["_" + e]
      }

      function st(t, e) {
        var o, i;
        for (i = 0; i < k.props.length; i += 1) void 0 !== t[o = k.props[i]] && (t["_" + o] = t[o], k.propsObj[o] = !0, e && delete t[o])
      }

      function rt(t, e, o) {
        var i, n, a, s;
        for (i in o)
          if (Object.prototype.hasOwnProperty.call(o, i) && (_(n = o[i]) && (o[i] = n.call(t, e, i)), "object" === c(n) && u(n))) {
            for (a in n) Object.prototype.hasOwnProperty.call(n, a) && (s = n[a], void 0 !== e[i] && (e[i + "." + a] = e[i][a], o[i + "." + a] = s));
            delete o[i]
          } return o
      }

      function lt(t) {
        var e;
        for (e in t) Object.prototype.hasOwnProperty.call(t, e) && -1 !== e.indexOf(".") && delete t[e]
      }

      function ht(e) {
        var o, n, a = [],
          s = 1;
        return "transparent" === e ? e = "rgba(0, 0, 0, 0)" : e.match(/^([a-z]+|#[0-9a-f]+)$/gi) && (o = (n = i.head).style.color, n.style.color = e, e = t.css(n, "color"), n.style.color = o), e.match(/^rgb/gi) && (a = e.match(/(\d+(\.\d+)?)/gi), e.match(/%/gi) && (s = 2.55), a[0] *= s, a[1] *= s, a[2] *= s, void 0 !== a[3] ? a[3] = h(a[3]) : a[3] = 1), a
      }

      function dt(t) {
        var e, o = 3;
        for ("array" !== c(t.start) && (t.start = ht(t.start), t.end = ht(t.end)), t.now = [], 1 === t.start[3] && 1 === t.end[3] || (o = 4), e = 0; e < o; e += 1) t.now[e] = t.start[e] + (t.end[e] - t.start[e]) * t.pos, e < 3 && (t.now[e] = w(t.now[e]));
        1 !== t.start[3] || 1 !== t.end[3] ? t.now = "rgba(" + t.now.join(",") + ")" : (t.now.slice(0, 3), t.now = "rgb(" + t.now.join(",") + ")"), t.elem.nodeName ? t.elem.style[t.prop] = t.now : t.elem[t.prop] = t.now
      }

      function ft(t) {
        return b.mouseEvents[t] && (t = b.mouseEvents[t]), t
      }

      function ct(t) {
        L.events[t] = function (e, o) {
          var i, n, a;

          function s(t) {
            a.x = t.offsetX, a.y = t.offsetY, a.type = i, a.event = t, ("mousemove" !== t.type || o.redrawOnMousemove || o.drag.dragging) && e.drawLayers({
              resetFire: !0
            }), t.preventDefault()
          }
          a = o.event, n = function (t) {
            return b.touchEvents[t] && (t = b.touchEvents[t]), t
          }(i = "mouseover" === t || "mouseout" === t ? "mousemove" : t), o.events[i] || (n !== i ? e.bind(i + ".jCanvas " + n + ".jCanvas", s) : e.bind(i + ".jCanvas", s), o.events[i] = !0)
        }
      }

      function ut(t, e, o) {
        var i, n, a, s, r, l, h, d;
        (i = o._args) && (null !== (a = (n = U(t)).event).x && null !== a.y && (l = a.x * n.pixelRatio, h = a.y * n.pixelRatio, s = e.isPointInPath(l, h) || e.isPointInStroke && e.isPointInStroke(l, h)), r = n.transforms, i.eventX = a.x, i.eventY = a.y, i.event = a.event, d = n.transforms.rotate, l = i.eventX, h = i.eventY, 0 !== d ? (i._eventX = l * p(-d) - h * x(-d), i._eventY = h * p(-d) + l * x(-d)) : (i._eventX = l, i._eventY = h), i._eventX /= r.scaleX, i._eventY /= r.scaleY, s && n.intersecting.push(i), i.intersects = Boolean(s))
      }

      function gt(t, e, o) {
        e._toRad = e.inDegrees ? g / 180 : 1, t.translate(e.x, e.y), t.rotate(e.rotate * e._toRad), t.translate(-e.x, -e.y), o && (o.rotate += e.rotate * e._toRad)
      }

      function wt(t, e, o) {
        1 !== e.scale && (e.scaleX = e.scaleY = e.scale), t.translate(e.x, e.y), t.scale(e.scaleX, e.scaleY), t.translate(-e.x, -e.y), o && (o.scaleX *= e.scaleX, o.scaleY *= e.scaleY)
      }

      function yt(t, e, o) {
        e.translate && (e.translateX = e.translateY = e.translate), t.translate(e.translateX, e.translateY), o && (o.translateX += e.translateX, o.translateY += e.translateY)
      }

      function xt(t) {
        for (; t < 0;) t += 2 * g;
        return t
      }

      function pt(t, e) {
        return t.x + t.radius * p(e)
      }

      function mt(t, e) {
        return t.y + t.radius * x(e)
      }

      function vt(t, e, o, i) {
        var n, a, s, r, l;
        o === i ? (s = 0, r = 0) : (s = o.x, r = o.y), i.inDegrees || 360 !== i.end || (i.end = 2 * g), i.start *= o._toRad, i.end *= o._toRad, i.start -= g / 2, i.end -= g / 2, l = g / 180, i.ccw && (l *= -1), bt(t, e, o, i, pt(i, i.start + l), mt(i, i.start + l), pt(i, i.start), mt(i, i.start)), e.arc(i.x + s, i.y + r, i.radius, i.start, i.end, i.ccw), n = pt(i, i.end + l), a = mt(i, i.end + l), It(t, e, o, i, pt(i, i.end), mt(i, i.end), n, a)
      }

      function Tt(t, e, o, i, n, a, s, r) {
        var l, h, d, f, c, u, w;
        i.arrowRadius && !o.closed && (w = m(r - a, s - n), w -= g, c = o.strokeWidth * p(w), u = o.strokeWidth * x(w), l = s + i.arrowRadius * p(w + i.arrowAngle / 2), h = r + i.arrowRadius * x(w + i.arrowAngle / 2), d = s + i.arrowRadius * p(w - i.arrowAngle / 2), f = r + i.arrowRadius * x(w - i.arrowAngle / 2), e.moveTo(l - c, h - u), e.lineTo(s - c, r - u), e.lineTo(d - c, f - u), e.moveTo(s - c, r - u), e.lineTo(s + c, r + u), e.moveTo(s, r))
      }

      function bt(t, e, o, i, n, a, s, r) {
        i._arrowAngleConverted || (i.arrowAngle *= o._toRad, i._arrowAngleConverted = !0), i.startArrow && Tt(0, e, o, i, n, a, s, r)
      }

      function It(t, e, o, i, n, a, s, r) {
        i._arrowAngleConverted || (i.arrowAngle *= o._toRad, i._arrowAngleConverted = !0), i.endArrow && Tt(0, e, o, i, n, a, s, r)
      }

      function Nt(t, e, o, i) {
        var n, a, s;
        for (n = 2, bt(0, e, o, i, i.x2 + o.x, i.y2 + o.y, i.x1 + o.x, i.y1 + o.y), void 0 !== i.x1 && void 0 !== i.y1 && e.moveTo(i.x1 + o.x, i.y1 + o.y); a = i["x" + n], s = i["y" + n], void 0 !== a && void 0 !== s;) e.lineTo(a + o.x, s + o.y), n += 1;
        It(0, e, o, i, i["x" + ((n -= 1) - 1)] + o.x, i["y" + (n - 1)] + o.y, i["x" + n] + o.x, i["y" + n] + o.y)
      }

      function kt(t, e, o, i) {
        var n, a, s, r, l;
        for (n = 2, bt(0, e, o, i, i.cx1 + o.x, i.cy1 + o.y, i.x1 + o.x, i.y1 + o.y), void 0 !== i.x1 && void 0 !== i.y1 && e.moveTo(i.x1 + o.x, i.y1 + o.y); a = i["x" + n], s = i["y" + n], r = i["cx" + (n - 1)], l = i["cy" + (n - 1)], void 0 !== a && void 0 !== s && void 0 !== r && void 0 !== l;) e.quadraticCurveTo(r + o.x, l + o.y, a + o.x, s + o.y), n += 1;
        It(0, e, o, i, i["cx" + ((n -= 1) - 1)] + o.x, i["cy" + (n - 1)] + o.y, i["x" + n] + o.x, i["y" + n] + o.y)
      }

      function Mt(t, e, o, i) {
        var n, a, s, r, l, h, d, f;
        for (n = 2, a = 1, bt(0, e, o, i, i.cx1 + o.x, i.cy1 + o.y, i.x1 + o.x, i.y1 + o.y), void 0 !== i.x1 && void 0 !== i.y1 && e.moveTo(i.x1 + o.x, i.y1 + o.y); s = i["x" + n], r = i["y" + n], l = i["cx" + a], h = i["cy" + a], d = i["cx" + (a + 1)], f = i["cy" + (a + 1)], void 0 !== s && void 0 !== r && void 0 !== l && void 0 !== h && void 0 !== d && void 0 !== f;) e.bezierCurveTo(l + o.x, h + o.y, d + o.x, f + o.y, s + o.x, r + o.y), n += 1, a += 2;
        n -= 1, It(0, e, o, i, i["cx" + ((a -= 2) + 1)] + o.x, i["cy" + (a + 1)] + o.y, i["x" + n] + o.x, i["y" + n] + o.y)
      }

      function Ct(t, e, o) {
        return e *= t._toRad, o * p(e -= g / 2)
      }

      function Et(t, e, o) {
        return e *= t._toRad, o * x(e -= g / 2)
      }

      function Lt(t, e, o, i) {
        var n, a, s, r, l, h, d, f, c, u, g;
        for (o === i ? (r = 0, l = 0) : (r = o.x, l = o.y), n = 1, h = f = u = i.x + r, d = c = g = i.y + l, bt(0, e, o, i, h + Ct(o, i.a1, i.l1), d + Et(o, i.a1, i.l1), h, d), void 0 !== i.x && void 0 !== i.y && e.moveTo(h, d); a = i["a" + n], s = i["l" + n], void 0 !== a && void 0 !== s;) f = u, c = g, u += Ct(o, a, s), g += Et(o, a, s), e.lineTo(u, g), n += 1;
        It(0, e, o, i, f, c, u, g)
      }

      function St(t, e, o) {
        isNaN(l(o.fontSize)) || (o.fontSize += "px"), e.font = o.fontStyle + " " + o.fontSize + " " + o.fontFamily
      }

      function Ft(e, o, i, n) {
        var a, s, r, l = I.propCache;
        if (l.text === i.text && l.fontStyle === i.fontStyle && l.fontSize === i.fontSize && l.fontFamily === i.fontFamily && l.maxWidth === i.maxWidth && l.lineHeight === i.lineHeight) i.width = l.width, i.height = l.height;
        else {
          for (i.width = o.measureText(n[0]).width, r = 1; r < n.length; r += 1)(s = o.measureText(n[r]).width) > i.width && (i.width = s);
          a = e.style.fontSize, e.style.fontSize = i.fontSize, i.height = h(t.css(e, "fontSize")) * n.length * i.lineHeight, e.style.fontSize = a
        }
      }

      function _t(t, e) {
        var o, i, n, a, s, r, l = String(e.text),
          h = e.maxWidth,
          d = l.split("\n"),
          f = [];
        for (n = 0; n < d.length; n += 1) {
          if (o = [], i = "", 1 === (s = (a = d[n]).split(" ")).length || t.measureText(a).width < h) o = [a];
          else {
            for (r = 0; r < s.length; r += 1) t.measureText(i + s[r]).width > h && ("" !== i && o.push(i), i = ""), i += s[r], r !== s.length - 1 && (i += " ");
            o.push(i)
          }
          f = f.concat(o.join("\n").replace(/((\n))|($)/gi, "$2").split("\n"))
        }
        return f
      }
      S.baseDefaults = {
          align: "center",
          arrowAngle: 90,
          arrowRadius: 0,
          autosave: !0,
          baseline: "middle",
          bringToFront: !1,
          ccw: !1,
          closed: !1,
          compositing: "source-over",
          concavity: 0,
          cornerRadius: 0,
          count: 1,
          cropFromCenter: !0,
          crossOrigin: null,
          cursors: null,
          disableEvents: !1,
          draggable: !1,
          dragGroups: null,
          groups: null,
          data: null,
          dx: null,
          dy: null,
          end: 360,
          eventX: null,
          eventY: null,
          fillStyle: "transparent",
          fontStyle: "normal",
          fontSize: "12pt",
          fontFamily: "sans-serif",
          fromCenter: !0,
          height: null,
          imageSmoothing: !0,
          inDegrees: !0,
          intangible: !1,
          index: null,
          letterSpacing: null,
          lineHeight: 1,
          layer: !1,
          mask: !1,
          maxWidth: null,
          miterLimit: 10,
          name: null,
          opacity: 1,
          r1: null,
          r2: null,
          radius: 0,
          repeat: "repeat",
          respectAlign: !1,
          restrictDragToAxis: null,
          rotate: 0,
          rounded: !1,
          scale: 1,
          scaleX: 1,
          scaleY: 1,
          shadowBlur: 0,
          shadowColor: "transparent",
          shadowStroke: !1,
          shadowX: 0,
          shadowY: 0,
          sHeight: null,
          sides: 0,
          source: "",
          spread: 0,
          start: 0,
          strokeCap: "butt",
          strokeDash: null,
          strokeDashOffset: 0,
          strokeJoin: "miter",
          strokeStyle: "transparent",
          strokeWidth: 1,
          sWidth: null,
          sx: null,
          sy: null,
          text: "",
          translate: 0,
          translateX: 0,
          translateY: 0,
          type: null,
          visible: !0,
          width: null,
          x: 0,
          y: 0
        }, o = new S, C.prototype = o, L.extend = function (e) {
          return e.name && (e.props && d(o, e.props), t.fn[e.name] = function t(o) {
            var i, n, a, s;
            for (n = 0; n < this.length; n += 1)(a = P(i = this[n])) && (nt(i, s = new C(o), o, t), X(i, a, s), e.fn.call(i, a, s));
            return this
          }, e.type && (b.drawings[e.type] = e.name)), t.fn[e.name]
        }, t.fn.getEventHooks = function () {
          var t = {};
          return 0 !== this.length && (t = U(this[0]).eventHooks), t
        }, t.fn.setEventHooks = function (t) {
          var e, o;
          for (e = 0; e < this.length; e += 1) o = U(this[e]), d(o.eventHooks, t);
          return this
        }, t.fn.getLayers = function (t) {
          var e, o, i, n, a = [];
          if (0 !== this.length)
            if (o = U(e = this[0]).layers, _(t))
              for (n = 0; n < o.length; n += 1) i = o[n], t.call(e, i) && a.push(i);
            else a = o;
          return a
        }, t.fn.getLayer = function (t) {
          var e, o, i, n, a;
          if (0 !== this.length)
            if (o = (e = U(this[0])).layers, a = c(t), t && t.layer) i = t;
            else if ("number" === a) t < 0 && (t = o.length + t), i = o[t];
          else if ("regexp" === a) {
            for (n = 0; n < o.length; n += 1)
              if (F(o[n].name) && o[n].name.match(t)) {
                i = o[n];
                break
              }
          } else i = e.layer.names[t];
          return i
        }, t.fn.getLayerGroup = function (t) {
          var e, o, i, n, a = c(t);
          if (0 !== this.length)
            if (e = this[0], "array" === a) n = t;
            else if ("regexp" === a) {
            for (i in o = U(e).layer.groups)
              if (i.match(t)) {
                n = o[i];
                break
              }
          } else n = U(e).layer.groups[t];
          return n
        }, t.fn.getLayerIndex = function (t) {
          var e = this.getLayers(),
            o = this.getLayer(t);
          return f(o, e)
        }, t.fn.setLayer = function (e, o) {
          var i, n, a, s, r, l, f;
          for (n = 0; n < this.length; n += 1)
            if (i = t(this[n]), a = U(this[n]), s = t(this[n]).getLayer(e)) {
              for (r in K(0, a, s, o), Q(0, a, s, o), R(o), o) Object.prototype.hasOwnProperty.call(o, r) && (l = o[r], "object" === (f = c(l)) && u(l) ? (s[r] = d({}, l), R(s[r])) : "array" === f ? s[r] = l.slice(0) : "string" === f ? 0 === l.indexOf("+=") ? s[r] += h(l.substr(2)) : 0 === l.indexOf("-=") ? s[r] -= h(l.substr(2)) : !isNaN(l) && A(l) && "text" !== r ? s[r] = h(l) : s[r] = l : s[r] = l);
              W(i, a, s), q(i, a, s), !1 === t.isEmptyObject(o) && it(i, a, s, "change", o)
            } return this
        }, t.fn.setLayers = function (e, o) {
          var i, n, a, s;
          for (n = 0; n < this.length; n += 1)
            for (a = (i = t(this[n])).getLayers(o), s = 0; s < a.length; s += 1) i.setLayer(a[s], e);
          return this
        }, t.fn.setLayerGroup = function (e, o) {
          var i, n, a, s;
          for (n = 0; n < this.length; n += 1)
            if (a = (i = t(this[n])).getLayerGroup(e))
              for (s = 0; s < a.length; s += 1) i.setLayer(a[s], o);
          return this
        }, t.fn.moveLayer = function (e, o) {
          var i, n, a, s, r;
          for (n = 0; n < this.length; n += 1) i = t(this[n]), s = (a = U(this[n])).layers, (r = i.getLayer(e)) && (r.index = f(r, s), s.splice(r.index, 1), s.splice(o, 0, r), o < 0 && (o = s.length + o), r.index = o, it(i, a, r, "move"));
          return this
        }, t.fn.removeLayer = function (e) {
          var o, i, n, a, s;
          for (i = 0; i < this.length; i += 1) o = t(this[i]), n = U(this[i]), a = o.getLayers(), (s = o.getLayer(e)) && (s.index = f(s, a), a.splice(s.index, 1), delete s._layer, K(0, n, s, {
            name: null
          }), Q(0, n, s, {
            groups: null
          }), it(o, n, s, "remove"));
          return this
        }, t.fn.removeLayers = function (e) {
          var o, i, n, a, s, r;
          for (i = 0; i < this.length; i += 1) {
            for (o = t(this[i]), n = U(this[i]), a = o.getLayers(e).slice(0), r = 0; r < a.length; r += 1) s = a[r], o.removeLayer(s);
            n.layer.names = {}, n.layer.groups = {}
          }
          return this
        }, t.fn.removeLayerGroup = function (e) {
          var o, i, n, a;
          if (void 0 !== e)
            for (i = 0; i < this.length; i += 1)
              if (n = (o = t(this[i])).getLayerGroup(e))
                for (n = n.slice(0), a = 0; a < n.length; a += 1) o.removeLayer(n[a]);
          return this
        }, t.fn.addLayerToGroup = function (e, o) {
          var i, n, a, s = [o];
          for (n = 0; n < this.length; n += 1)(a = (i = t(this[n])).getLayer(e)).groups && (s = a.groups.slice(0), -1 === f(o, a.groups) && s.push(o)), i.setLayer(a, {
            groups: s
          });
          return this
        }, t.fn.removeLayerFromGroup = function (e, o) {
          var i, n, a, s, r = [];
          for (n = 0; n < this.length; n += 1)(a = (i = t(this[n])).getLayer(e)).groups && -1 !== (s = f(o, a.groups)) && ((r = a.groups.slice(0)).splice(s, 1), i.setLayer(a, {
            groups: r
          }));
          return this
        }, k.cursors = ["grab", "grabbing", "zoom-in", "zoom-out"], k.prefix = (E = s(i.documentElement, ""), "-" + (v.call(E).join("").match(/-(moz|webkit|ms)-/) || "" === E.OLink && ["", "o"])[1] + "-"), t.fn.triggerLayerEvent = function (e, o) {
          var i, n, a;
          for (n = 0; n < this.length; n += 1) i = t(this[n]), a = U(this[n]), (e = i.getLayer(e)) && it(i, a, e, o);
          return this
        }, t.fn.drawLayer = function (e) {
          var o, i, n;
          for (o = 0; o < this.length; o += 1) i = t(this[o]), P(this[o]) && (n = i.getLayer(e), Z(i, 0, n));
          return this
        }, t.fn.drawLayers = function (e) {
          var o, i, n, a, s, r, l, h, d, f, c, u, g = e || {};
          for ((l = g.index) || (l = 0), i = 0; i < this.length; i += 1)
            if (o = t(this[i]), P(this[i])) {
              for (d = U(this[i]), !1 !== g.clear && o.clearCanvas(), g.complete && (d.drawLayersComplete = g.complete), n = d.layers, r = l; r < n.length; r += 1)
                if ((a = n[r]).index = r, g.resetFire && (a._fired = !1), Z(o, 0, a, r + 1), a._masks = d.transforms.masks.slice(0), a._method === t.fn.drawImage && a.visible) {
                  u = !0;
                  break
                } if (u) continue;
              h = r, g.complete && (g.complete.call(this[i]), delete d.drawLayersComplete), a = V(d), c = (f = d.event).type, d.drag.layer && tt(o, d, c), null === (s = d.lastIntersected) || a === s || !s._hovered || s._fired || d.drag.dragging || (d.lastIntersected = null, s._fired = !0, s._hovered = !1, it(o, d, s, "mouseout"), et(o, d)), a && (a[c] || (c = ft(c)), a._event && a.intersects && (d.lastIntersected = a, (a.mouseover || a.mouseout || a.cursors) && !d.drag.dragging && (a._hovered || a._fired || (a._fired = !0, a._hovered = !0, it(o, d, a, "mouseover"))), a._fired || (a._fired = !0, f.type = null, it(o, d, a, c)), !a.draggable || a.disableEvents || "mousedown" !== c && "touchstart" !== c || (d.drag.layer = a, d.originalRedrawOnMousemove = d.redrawOnMousemove, d.redrawOnMousemove = !0))), null !== a || d.drag.dragging || et(o, d), h === n.length && (d.intersecting.length = 0, d.transforms = O(N), d.savedTransforms.length = 0)
            } return this
        }, t.fn.addLayer = function (t) {
          var e, o;
          for (e = 0; e < this.length; e += 1) P(this[e]) && ((o = new C(t)).layer = !0, nt(this[e], o, t));
          return this
        }, k.props = ["width", "height", "opacity", "lineHeight"], k.propsObj = {}, t.fn.animateLayer = function () {
          var e, o, i, n, a, s = this,
            r = v.call(arguments, 0);

          function l(t, e, o) {
            return function () {
              at(o), lt(o), e.animating && e.animated !== o || t.drawLayers(), o._animating = !1, e.animating = !1, e.animated = null, r[4] && r[4].call(t[0], o), it(t, e, o, "animateend")
            }
          }

          function h(t, e, o) {
            return function (i, n) {
              var a, s, l, h = !1;
              "_" === n.prop[0] && (h = !0, n.prop = n.prop.replace("_", ""), o[n.prop] = o["_" + n.prop]), -1 !== n.prop.indexOf(".") && (s = (a = n.prop.split("."))[0], l = a[1], o[s] && (o[s][l] = n.now)), o._pos !== n.pos && (o._pos = n.pos, o._animating || e.animating || (o._animating = !0, e.animating = !0, e.animated = o), e.animating && e.animated !== o || t.drawLayers()), r[5] && r[5].call(t[0], i, n, o), it(t, e, o, "animate", n), h && (n.prop = "_" + n.prop)
            }
          }
          for ("object" === c(r[2]) ? (r.splice(2, 0, r[2].duration || null), r.splice(3, 0, r[3].easing || null), r.splice(4, 0, r[4].complete || null), r.splice(5, 0, r[5].step || null)) : (void 0 === r[2] ? (r.splice(2, 0, null), r.splice(3, 0, null), r.splice(4, 0, null)) : _(r[2]) && (r.splice(2, 0, null), r.splice(3, 0, null)), void 0 === r[3] ? (r[3] = null, r.splice(4, 0, null)) : _(r[3]) && r.splice(3, 0, null)), o = 0; o < s.length; o += 1) e = t(s[o]), P(s[o]) && (i = U(s[o]), (n = e.getLayer(r[0])) && n._method !== t.fn.draw && (a = d({}, r[1]), st(a = rt(s[o], n, a), !0), st(n), n.style = k.propsObj, t(n).animate(a, {
            duration: r[2],
            easing: t.easing[r[3]] ? r[3] : null,
            complete: l(e, i, n),
            step: h(e, i, n)
          }), it(e, i, n, "animatestart")));
          return s
        }, t.fn.animateLayerGroup = function (e) {
          var o, i, n, a, s = this,
            r = v.call(arguments, 0);
          for (i = 0; i < s.length; i += 1)
            if (n = (o = t(s[i])).getLayerGroup(e))
              for (a = 0; a < n.length; a += 1) r[0] = n[a], o.animateLayer.apply(o, r);
          return s
        }, t.fn.delayLayer = function (e, o) {
          var i, n, a, s;
          for (o = o || 0, n = 0; n < this.length; n += 1) i = t(this[n]), a = U(this[n]), (s = i.getLayer(e)) && (t(s).delay(o), it(i, a, s, "delay"));
          return this
        }, t.fn.delayLayerGroup = function (e, o) {
          var i, n, a, s, r;
          for (o = o || 0, n = 0; n < this.length; n += 1)
            if (a = (i = t(this[n])).getLayerGroup(e))
              for (r = 0; r < a.length; r += 1) s = a[r], i.delayLayer(s, o);
          return this
        }, t.fn.stopLayer = function (e, o) {
          var i, n, a, s;
          for (n = 0; n < this.length; n += 1) i = t(this[n]), a = U(this[n]), (s = i.getLayer(e)) && (t(s).stop(o), it(i, a, s, "stop"));
          return this
        }, t.fn.stopLayerGroup = function (e, o) {
          var i, n, a, s, r;
          for (n = 0; n < this.length; n += 1)
            if (a = (i = t(this[n])).getLayerGroup(e))
              for (r = 0; r < a.length; r += 1) s = a[r], i.stopLayer(s, o);
          return this
        },
        function (e) {
          var o;
          for (o = 0; o < e.length; o += 1) t.fx.step[e[o]] = dt
        }(["color", "backgroundColor", "borderColor", "borderTopColor", "borderRightColor", "borderBottomColor", "borderLeftColor", "fillStyle", "outlineColor", "strokeStyle", "shadowColor"]), b.touchEvents = {
          mousedown: "touchstart",
          mouseup: "touchend",
          mousemove: "touchmove"
        }, b.mouseEvents = {
          touchstart: "mousedown",
          touchend: "mouseup",
          touchmove: "mousemove"
        },
        function (t) {
          var e;
          for (e = 0; e < t.length; e += 1) ct(t[e])
        }(["click", "dblclick", "mousedown", "mouseup", "mousemove", "mouseover", "mouseout", "touchstart", "touchmove", "touchend", "pointerdown", "pointermove", "pointerup", "contextmenu"]), t.event.fix = function (e) {
          var o, i, n;
          if (i = (e = T.call(t.event, e)).originalEvent)
            if (n = i.changedTouches, void 0 !== e.pageX && void 0 === e.offsetX) try {
              (o = t(e.currentTarget).offset()) && (e.offsetX = e.pageX - o.left, e.offsetY = e.pageY - o.top)
            } catch (a) {} else if (n) try {
              (o = t(e.currentTarget).offset()) && (e.offsetX = n[0].pageX - o.left, e.offsetY = n[0].pageY - o.top)
            } catch (a) {}
          return e
        }, b.drawings = {
          arc: "drawArc",
          bezier: "drawBezier",
          ellipse: "drawEllipse",
          function: "draw",
          image: "drawImage",
          line: "drawLine",
          path: "drawPath",
          polygon: "drawPolygon",
          slice: "drawSlice",
          quadratic: "drawQuadratic",
          rectangle: "drawRect",
          text: "drawText",
          vector: "drawVector",
          save: "saveCanvas",
          restore: "restoreCanvas",
          rotate: "rotateCanvas",
          scale: "scaleCanvas",
          translate: "translateCanvas"
        }, t.fn.draw = function t(e) {
          var o, i, n = new C(e);
          if (b.drawings[n.type] && "function" !== n.type) this[b.drawings[n.type]](e);
          else
            for (o = 0; o < this.length; o += 1)(i = P(this[o])) && (n = new C(e), nt(this[o], n, e, t), n.visible && n.fn && n.fn.call(this[o], i, n));
          return this
        }, t.fn.clearCanvas = function t(e) {
          var o, i, n = new C(e);
          for (o = 0; o < this.length; o += 1)(i = P(this[o])) && (null === n.width || null === n.height ? (i.save(), i.setTransform(1, 0, 0, 1, 0, 0), i.clearRect(0, 0, this[o].width, this[o].height), i.restore()) : (nt(this[o], n, e, t), j(this[o], i, n, n.width, n.height), i.clearRect(n.x - n.width / 2, n.y - n.height / 2, n.width, n.height), G(i, n)));
          return this
        }, t.fn.saveCanvas = function t(e) {
          var o, i, n, a, s;
          for (o = 0; o < this.length; o += 1)
            if (i = P(this[o]))
              for (a = U(this[o]), n = new C(e), nt(this[o], n, e, t), s = 0; s < n.count; s += 1) z(i, a);
          return this
        }, t.fn.restoreCanvas = function t(e) {
          var o, i, n, a, s;
          for (o = 0; o < this.length; o += 1)
            if (i = P(this[o]))
              for (a = U(this[o]), n = new C(e), nt(this[o], n, e, t), s = 0; s < n.count; s += 1) D(i, a);
          return this
        }, t.fn.rotateCanvas = function t(e) {
          var o, i, n, a;
          for (o = 0; o < this.length; o += 1)(i = P(this[o])) && (a = U(this[o]), n = new C(e), nt(this[o], n, e, t), n.autosave && z(i, a), gt(i, n, a.transforms));
          return this
        }, t.fn.scaleCanvas = function t(e) {
          var o, i, n, a;
          for (o = 0; o < this.length; o += 1)(i = P(this[o])) && (a = U(this[o]), n = new C(e), nt(this[o], n, e, t), n.autosave && z(i, a), wt(i, n, a.transforms));
          return this
        }, t.fn.translateCanvas = function t(e) {
          var o, i, n, a;
          for (o = 0; o < this.length; o += 1)(i = P(this[o])) && (a = U(this[o]), n = new C(e), nt(this[o], n, e, t), n.autosave && z(i, a), yt(i, n, a.transforms));
          return this
        }, t.fn.drawRect = function t(e) {
          var o, i, n, a, s, r, l, h, d;
          for (o = 0; o < this.length; o += 1)(i = P(this[o])) && (n = new C(e), nt(this[o], n, e, t), n.visible && (j(this[o], i, n, n.width, n.height), X(this[o], i, n), i.beginPath(), n.width && n.height && (a = n.x - n.width / 2, s = n.y - n.height / 2, (h = y(n.cornerRadius)) ? (r = n.x + n.width / 2, l = n.y + n.height / 2, n.width < 0 && (d = a, a = r, r = d), n.height < 0 && (d = s, s = l, l = d), r - a - 2 * h < 0 && (h = (r - a) / 2), l - s - 2 * h < 0 && (h = (l - s) / 2), i.moveTo(a + h, s), i.lineTo(r - h, s), i.arc(r - h, s + h, h, 3 * g / 2, 2 * g, !1), i.lineTo(r, l - h), i.arc(r - h, l - h, h, 0, g / 2, !1), i.lineTo(a + h, l), i.arc(a + h, l - h, h, g / 2, g, !1), i.lineTo(a, s + h), i.arc(a + h, s + h, h, g, 3 * g / 2, !1), n.closed = !0) : i.rect(a, s, n.width, n.height)), ut(this[o], i, n), B(this[o], i, n)));
          return this
        }, t.fn.drawArc = function t(e) {
          var o, i, n;
          for (o = 0; o < this.length; o += 1)(i = P(this[o])) && (n = new C(e), nt(this[o], n, e, t), n.visible && (j(this[o], i, n, 2 * n.radius), X(this[o], i, n), i.beginPath(), vt(this[o], i, n, n), ut(this[o], i, n), B(this[o], i, n)));
          return this
        }, t.fn.drawEllipse = function t(e) {
          var o, i, n, a, s;
          for (o = 0; o < this.length; o += 1)(i = P(this[o])) && (n = new C(e), nt(this[o], n, e, t), n.visible && (j(this[o], i, n, n.width, n.height), X(this[o], i, n), a = n.width * (4 / 3), s = n.height, i.beginPath(), i.moveTo(n.x, n.y - s / 2), i.bezierCurveTo(n.x - a / 2, n.y - s / 2, n.x - a / 2, n.y + s / 2, n.x, n.y + s / 2), i.bezierCurveTo(n.x + a / 2, n.y + s / 2, n.x + a / 2, n.y - s / 2, n.x, n.y - s / 2), ut(this[o], i, n), n.closed = !0, B(this[o], i, n)));
          return this
        }, t.fn.drawPolygon = function t(e) {
          var o, i, n, a, s, r, l, h, d, f;
          for (o = 0; o < this.length; o += 1)
            if ((i = P(this[o])) && (n = new C(e), nt(this[o], n, e, t), n.visible)) {
              for (j(this[o], i, n, 2 * n.radius), X(this[o], i, n), a = (r = (s = 2 * g / n.sides) / 2) + g / 2, l = n.radius * p(r), i.beginPath(), f = 0; f < n.sides; f += 1) h = n.x + n.radius * p(a), d = n.y + n.radius * x(a), i.lineTo(h, d), n.concavity && (h = n.x + (l + -l * n.concavity) * p(a + r), d = n.y + (l + -l * n.concavity) * x(a + r), i.lineTo(h, d)), a += s;
              ut(this[o], i, n), n.closed = !0, B(this[o], i, n)
            } return this
        }, t.fn.drawSlice = function t(e) {
          var o, i, n, a, s, r;
          for (o = 0; o < this.length; o += 1)(i = P(this[o])) && (n = new C(e), nt(this[o], n, e, t), n.visible && (j(this[o], i, n, 2 * n.radius), X(this[o], i, n), n.start *= n._toRad, n.end *= n._toRad, n.start -= g / 2, n.end -= g / 2, n.start = xt(n.start), n.end = xt(n.end), n.end < n.start && (n.end += 2 * g), a = (n.start + n.end) / 2, s = n.radius * n.spread * p(a), r = n.radius * n.spread * x(a), n.x += s, n.y += r, i.beginPath(), i.arc(n.x, n.y, n.radius, n.start, n.end, n.ccw), i.lineTo(n.x, n.y), ut(this[o], i, n), n.closed = !0, B(this[o], i, n)));
          return this
        }, t.fn.drawLine = function t(e) {
          var o, i, n;
          for (o = 0; o < this.length; o += 1)(i = P(this[o])) && (n = new C(e), nt(this[o], n, e, t), n.visible && (j(this[o], i, n), X(this[o], i, n), i.beginPath(), Nt(this[o], i, n, n), ut(this[o], i, n), B(this[o], i, n)));
          return this
        }, t.fn.drawQuadratic = function t(e) {
          var o, i, n;
          for (o = 0; o < this.length; o += 1)(i = P(this[o])) && (n = new C(e), nt(this[o], n, e, t), n.visible && (j(this[o], i, n), X(this[o], i, n), i.beginPath(), kt(this[o], i, n, n), ut(this[o], i, n), B(this[o], i, n)));
          return this
        }, t.fn.drawBezier = function t(e) {
          var o, i, n;
          for (o = 0; o < this.length; o += 1)(i = P(this[o])) && (n = new C(e), nt(this[o], n, e, t), n.visible && (j(this[o], i, n), X(this[o], i, n), i.beginPath(), Mt(this[o], i, n, n), ut(this[o], i, n), B(this[o], i, n)));
          return this
        }, t.fn.drawVector = function t(e) {
          var o, i, n;
          for (o = 0; o < this.length; o += 1)(i = P(this[o])) && (n = new C(e), nt(this[o], n, e, t), n.visible && (j(this[o], i, n), X(this[o], i, n), i.beginPath(), Lt(this[o], i, n, n), ut(this[o], i, n), B(this[o], i, n)));
          return this
        }, t.fn.drawPath = function t(e) {
          var o, i, n, a, s;
          for (o = 0; o < this.length; o += 1)
            if ((i = P(this[o])) && (n = new C(e), nt(this[o], n, e, t), n.visible)) {
              for (j(this[o], i, n), X(this[o], i, n), i.beginPath(), a = 1; void 0 !== (s = n["p" + a]);) "line" === (s = new C(s)).type ? Nt(this[o], i, n, s) : "quadratic" === s.type ? kt(this[o], i, n, s) : "bezier" === s.type ? Mt(this[o], i, n, s) : "vector" === s.type ? Lt(this[o], i, n, s) : "arc" === s.type && vt(this[o], i, n, s), a += 1;
              ut(this[o], i, n), B(this[o], i, n)
            } return this
        }, t.fn.drawText = function t(e) {
          var o, i, n, a, s, r, l, d, f, c, u, w, y;
          for (o = 0; o < this.length; o += 1)
            if ((i = P(this[o])) && (n = new C(e), nt(this[o], n, e, t), n.visible)) {
              if (i.textBaseline = n.baseline, i.textAlign = n.align, St(this[o], i, n), a = null !== n.maxWidth ? _t(i, n) : n.text.toString().split("\n"), Ft(this[o], i, n, a), j(this[o], i, n, n.width, n.height), X(this[o], i, n), w = n.x, "left" === n.align ? n.respectAlign ? n.x += n.width / 2 : w -= n.width / 2 : "right" === n.align && (n.respectAlign ? n.x -= n.width / 2 : w += n.width / 2), n.radius)
                for (l = h(n.fontSize), null === n.letterSpacing && (n.letterSpacing = l / 500), r = 0; r < a.length; r += 1) {
                  for (i.save(), i.translate(n.x, n.y), s = a[r], n.flipArcText && ((f = s.split("")).reverse(), s = f.join("")), d = s.length, i.rotate(-g * n.letterSpacing * (d - 1) / 2), u = 0; u < d; u += 1) c = s[u], 0 !== u && i.rotate(g * n.letterSpacing), i.save(), i.translate(0, -n.radius), n.flipArcText && i.scale(-1, -1), i.fillText(c, 0, 0), "transparent" !== n.fillStyle && (i.shadowColor = "transparent"), 0 !== n.strokeWidth && i.strokeText(c, 0, 0), i.restore();
                  n.radius -= l, n.letterSpacing += l / (1e3 * g), i.restore()
                } else
                  for (r = 0; r < a.length; r += 1) s = a[r], y = n.y + r * n.height / a.length - (a.length - 1) * n.height / a.length / 2, i.shadowColor = n.shadowColor, i.fillText(s, w, y), "transparent" !== n.fillStyle && (i.shadowColor = "transparent"), 0 !== n.strokeWidth && i.strokeText(s, w, y);
              y = 0, "top" === n.baseline ? y += n.height / 2 : "bottom" === n.baseline && (y -= n.height / 2), n._event && (i.beginPath(), i.rect(n.x - n.width / 2, n.y - n.height / 2 + y, n.width, n.height), ut(this[o], i, n), i.closePath()), G(i, n)
            } return I.propCache = n, this
        }, t.fn.measureText = function (t) {
          var e, o, i;
          return (!(o = this.getLayer(t)) || o && !o._layer) && (o = new C(t)), (e = P(this[0])) && (St(this[0], e, o), i = null !== o.maxWidth ? _t(e, o) : o.text.split("\n"), Ft(this[0], e, o, i)), o
        }, t.fn.drawImage = function e(o) {
          var i, a, s, r, l, h, d, f, c, u = I.imageCache;

          function g(e, o, i, n, a) {
            return function () {
              var s = t(e);
              if (function (t, e, o, i, n) {
                  null === i.width && null === i.sWidth && (i.width = i.sWidth = d.width), null === i.height && null === i.sHeight && (i.height = i.sHeight = d.height), n && (n.width = i.width, n.height = i.height), null !== i.sWidth && null !== i.sHeight && null !== i.sx && null !== i.sy ? (null === i.width && (i.width = i.sWidth), null === i.height && (i.height = i.sHeight), i.cropFromCenter && (i.sx += i.sWidth / 2, i.sy += i.sHeight / 2), i.sy - i.sHeight / 2 < 0 && (i.sy = i.sHeight / 2), i.sy + i.sHeight / 2 > d.height && (i.sy = d.height - i.sHeight / 2), i.sx - i.sWidth / 2 < 0 && (i.sx = i.sWidth / 2), i.sx + i.sWidth / 2 > d.width && (i.sx = d.width - i.sWidth / 2), j(0, e, i, i.width, i.height), X(t, e, i), e.drawImage(d, i.sx - i.sWidth / 2, i.sy - i.sHeight / 2, i.sWidth, i.sHeight, i.x - i.width / 2, i.y - i.height / 2, i.width, i.height)) : (j(0, e, i, i.width, i.height), X(t, e, i), e.drawImage(d, i.x - i.width / 2, i.y - i.height / 2, i.width, i.height)), e.beginPath(), e.rect(i.x - i.width / 2, i.y - i.height / 2, i.width, i.height), ut(t, e, i), e.closePath(), G(e, i), Y(e, o, i)
                }(e, o, i, n, a), n.layer ? it(s, i, a, "load") : n.load && n.load.call(s[0], a), n.layer && (a._masks = i.transforms.masks.slice(0), n._next)) {
                var r = i.drawLayersComplete;
                delete i.drawLayersComplete, s.drawLayers({
                  clear: !1,
                  resetFire: !0,
                  index: n._next,
                  complete: r
                })
              }
            }
          }
          for (a = 0; a < this.length; a += 1) i = this[a], (s = P(this[a])) && (r = U(this[a]), l = new C(o), h = nt(this[a], l, o, e), l.visible && (f = (c = l.source).getContext, c.src || f ? d = c : c && (u[c] && u[c].complete ? d = u[c] : (d = new n, c.match(/^data:/i) || (d.crossOrigin = l.crossOrigin), d.src = c, u[c] = d)), d && (d.complete || f ? g(i, s, r, l, h)() : d.onload = g(i, s, r, l, h))));
          return this
        }, t.fn.createPattern = function (e) {
          var o, i, a, s, r, l, h = this;

          function d() {
            r = o.createPattern(a, i.repeat), i.load && i.load.call(h[0], r)
          }
          return (o = P(h[0])) ? _(l = (i = new C(e)).source) ? ((a = t("<canvas />")[0]).width = i.width, a.height = i.height, s = P(a), l.call(a, s), d()) : (s = l.getContext, l.src || s ? a = l : (a = new n, l.match(/^data:/i) || (a.crossOrigin = i.crossOrigin), a.src = l), a.complete || s ? d() : a.onload = d) : r = null, r
        }, t.fn.createGradient = function (t) {
          var e, o, i, n, a, s, r, l, h, d, f = [];
          if (o = new C(t), e = P(this[0])) {
            for (o.x1 = o.x1 || 0, o.y1 = o.y1 || 0, o.x2 = o.x2 || 0, o.y2 = o.y2 || 0, i = null !== o.r1 && null !== o.r2 ? e.createRadialGradient(o.x1, o.y1, o.r1, o.x2, o.y2, o.r2) : e.createLinearGradient(o.x1, o.y1, o.x2, o.y2), r = 1; void 0 !== o["c" + r]; r += 1) void 0 !== o["s" + r] ? f.push(o["s" + r]) : f.push(null);
            for (n = f.length, null === f[0] && (f[0] = 0), null === f[n - 1] && (f[n - 1] = 1), r = 0; r < n; r += 1) {
              if (null !== f[r]) {
                for (h = 1, d = 0, a = f[r], l = r + 1; l < n; l += 1) {
                  if (null !== f[l]) {
                    s = f[l];
                    break
                  }
                  h += 1
                }
                a > s && (f[l] = f[r])
              } else null === f[r] && (d += 1, f[r] = a + d * ((s - a) / h));
              i.addColorStop(f[r], o["c" + (r + 1)])
            }
          } else i = null;
          return i
        }, t.fn.setPixels = function t(e) {
          var o, i, n, a, s, r, l, h, d, f;
          for (i = 0; i < this.length; i += 1)
            if (n = P(o = this[i]), a = U(this[i]), n && (nt(o, s = new C(e), e, t), j(this[i], n, s, s.width, s.height), null !== s.width && null !== s.height || (s.width = o.width, s.height = o.height, s.x = s.width / 2, s.y = s.height / 2), 0 !== s.width && 0 !== s.height)) {
              if (f = (h = (l = n.getImageData((s.x - s.width / 2) * a.pixelRatio, (s.y - s.height / 2) * a.pixelRatio, s.width * a.pixelRatio, s.height * a.pixelRatio)).data).length, s.each)
                for (d = 0; d < f; d += 4) r = {
                  r: h[d],
                  g: h[d + 1],
                  b: h[d + 2],
                  a: h[d + 3]
                }, s.each.call(o, r, s), h[d] = r.r, h[d + 1] = r.g, h[d + 2] = r.b, h[d + 3] = r.a;
              n.putImageData(l, (s.x - s.width / 2) * a.pixelRatio, (s.y - s.height / 2) * a.pixelRatio), n.restore()
            } return this
        }, t.fn.getCanvasImage = function (t, e) {
          var o, i = null;
          return 0 !== this.length && (o = this[0]).toDataURL && (void 0 === e && (e = 1), i = o.toDataURL("image/" + t, e)), i
        }, t.fn.detectPixelRatio = function (t) {
          var o, i, n, a, s, r, l;
          for (i = 0; i < this.length; i += 1) n = P(o = this[i]), (l = U(this[i])).scaled || (1 !== (a = (e.devicePixelRatio || 1) / (n.webkitBackingStorePixelRatio || n.mozBackingStorePixelRatio || n.msBackingStorePixelRatio || n.oBackingStorePixelRatio || n.backingStorePixelRatio || 1)) && (s = o.width, r = o.height, o.width = s * a, o.height = r * a, o.style.width = s + "px", o.style.height = r + "px", n.scale(a, a)), l.pixelRatio = a, l.scaled = !0, t && t.call(o, a));
          return this
        }, L.clearCache = function () {
          var t;
          for (t in I) Object.prototype.hasOwnProperty.call(I, t) && (I[t] = {})
        }, t.support.canvas = void 0 !== t("<canvas />")[0].getContext, d(L, {
          defaults: o,
          setGlobalProps: X,
          transformShape: j,
          detectEvents: ut,
          closePath: B,
          setCanvasFont: St,
          measureText: Ft
        }), t.jCanvas = L, t.jCanvasObject = C
    }))
  },
  110: function (t, e) {
    var o = window.Arrow = function (t, e, o, i) {
      this.x1 = t, this.y1 = e, this.x2 = o, this.y2 = i, this.tmpX1 = null, this.tmpY1 = null, this.tmpX2 = null, this.tmpY2 = null, this.color = "black"
    };
    o.prototype.setColor = function (t) {
      this.color = t
    }, o.prototype.setHead = function (t) {
      this.head = t
    }, o.prototype.setDash = function (t) {
      this.isDash = t
    }, o.prototype.draw = function (t) {
      if (t.strokeStyle = this.color, t.fillStyle = this.color, t.lineWidth = 1, t.beginPath(), t.moveTo(this.x1, this.y1), this.isDash && (t.lineWidth = 1, t.setLineDash && (t.setLineDash([5, 10]), t.setLineDash([1, 5]))), null != this.tmpX1 && null != this.tmpY1 && null != this.tmpX2 && null != this.tmpY2) {
        t.lineTo(this.tmpX1, this.tmpY1), t.closePath(), t.stroke(), t.beginPath(), t.moveTo(this.tmpX1, this.tmpY1), t.lineTo(this.tmpX2, this.tmpY2), t.closePath(), t.stroke(), t.beginPath(), t.moveTo(this.tmpX2, this.tmpY2), t.lineTo(this.x2, this.y2), t.closePath(), t.stroke();
        var e = Math.atan((this.y2 - this.tmpY2) / (this.x2 - this.tmpX2));
        e += (this.x2 >= this.tmpX2 ? 90 : -90) * Math.PI / 180, this.head && this.drawArrowhead(t, this.x2, this.y2, e)
      } else if (null != this.tmpX1 && null != this.tmpY1 && null == this.tmpX2 && null == this.tmpY2) {
        t.lineTo(this.tmpX1, this.tmpY1), t.closePath(), t.stroke(), t.beginPath(), t.moveTo(this.tmpX1, this.tmpY1), t.lineTo(this.x2, this.y2), t.closePath(), t.stroke();
        e = Math.atan((this.y2 - this.tmpY1) / (this.x2 - this.tmpX1));
        e += (this.x2 >= this.tmpX1 ? 90 : -90) * Math.PI / 180, this.head && this.drawArrowhead(t, this.x2, this.y2, e)
      } else if (null == this.tmpX1 && null == this.tmpY1 && null == this.tmpX2 && null == this.tmpY2) {
        t.lineTo(this.x2, this.y2), t.closePath(), t.stroke();
        e = Math.atan((this.y2 - this.y1) / (this.x2 - this.x1));
        e += (this.x2 >= this.x1 ? 90 : -90) * Math.PI / 180, this.head && this.drawArrowhead(t, this.x2, this.y2, e)
      }
      t.setLineDash && t.setLineDash([])
    }, o.prototype.drawArrowhead = function (t, e, o, i) {
      t.save(), t.beginPath(), t.translate(e, o), t.rotate(i), t.moveTo(0, 0), this.isDash ? (t.lineTo(3, 6), t.lineTo(-3, 6)) : (t.lineTo(5, 10), t.lineTo(-5, 10)), t.closePath(), t.restore(), t.fill()
    }
  },
  111: function (t, e) {
    window.drawFlowImg = function (t) {
      for (var e in drawFn) this[e] = drawFn[e];
      for (var e in t) this[e] = t[e]
    }, window.drawFn = {
      drawFlowImage: function () {
        this.drawNode(), this.drawLine(), this.cxt.setLineDash && this.drawBohui()
      },
      clickNode: function (t) {
        var e = t.node,
          o = t.opinion,
          i = t.subInst,
          n = t.fn,
          a = t.type;
        e && (this.imageInfo.selectNode = e), n.drawMutiInstFlow(e, o, a), n.openCallActivity(e, i, a), n.drawDynamicNodeFlow(e)
      },
      drawDynamicNodeFlow: function (t) {
        var e = t.dynamicTaskCounts || "";
        if (e += "", t && e) {
          var o = t.opinions;
          if (o) {
            for (var i = t.id, n = {}, a = 0, s = 0; s < o.length; s++) {
              var r = (n[o[s].taskName] || {
                opIdx: a++
              }).opIdx;
              n[o[s].taskName] = o[s], n[o[s].taskName].opIdx = r
            }
            var l = {};
            for (var s in n) {
              l[i + "_" + (u = n[s]).opIdx] = [u]
            }
            var h = e.split("/"),
              d = parseInt(h[h.length - 1]),
              f = {},
              c = {};
            for (s = 0; s < d; s++) {
              var u, g = i + "_" + s,
                w = {
                  id: g,
                  height: 80,
                  width: 100,
                  x: 100 + 100 * s + 80 * s,
                  y: 100,
                  taskName: (u = l[g] && l[g][0] || {}).taskName || t.nodeName,
                  op: u
                };
              if (f[g] = w, s < d - 1) {
                var y = [{
                  id: g = i + "_line_" + s,
                  height: 0,
                  width: 0,
                  x: 100 + 100 * s + 80 * s + 100,
                  y: 140
                }, {
                  id: g,
                  height: 0,
                  width: 0,
                  x: 100 + 100 * s + 80 * s + 100 + 80,
                  y: 140
                }];
                c[g] = y
              }
            }
            var x = [],
              p = [];
            for (var s in f) x.push(f[s]);
            for (var s in c) p.push(c[s]);
            var m = [],
              v = [];
            for (s = 0; s < x.length; s++) {
              var T = {
                id: (t = x[s]).id,
                name: t.taskName,
                status: t.op.status || "default",
                type: "UserTask"
              };
              if (m.push(T), v.push({
                  actionName: t.op.status || "default",
                  nodeId: t.id,
                  nodeType: "userTask",
                  nodeName: t.taskName
                }), s < x.length - 1) {
                var b = p[s][0],
                  I = {
                    id: b.id,
                    sourceRef: x[s].id,
                    targetRef: x[s + 1].id,
                    status: t.op.status || "default",
                    type: "SequenceFlow"
                  };
                m.push(I), v.push({
                  actionName: t.op.status || "default",
                  nodeId: b.id,
                  nodeType: "sequenceFlow"
                }), T.outgoingFlows = [I]
              }
            }
            var N = {};
            N.nodeMap = f, N.flowLocation = c, N.flowElements = m, N.opinionMap = l, N.stacks = v, this.scope.subImageInfo = N;
            var k = new flowCanvas(this.scope, i + "_flowImageCanvas", N, !0),
              M = k.initDraw();
            $("#flowImgModalTitle").text(t.taskName + "-动态任务流程图"), $("#flowImgModal").modal("show"), $("#flowImgModalBody").html(k.canvas), M.drawFlowImage()
          }
        }
      },
      drawMutiInstFlow: function (t, e, o) {
        if (!o || "opinion" == o) {
          if (this.createCanvas) return !1;
          var i = "";
          this.scope;
          if (t && t.multInst) {
            if (e) return
          } else {
            if (e) {
              t = function t(e) {
                return e ? "start" == e.multInst ? e : t(e.preNodeMap) : null
              }(e.node)
            }
            if (!t || !t.multInst) return;
            i = e.node.id
          }
          var n = t.id,
            a = {};
          if ("start" == t.multInst ? a = this.getFLowImageInfo(n, t.multInst_end) : (t.multInst_start, a = this.getFLowImageInfo(t.multInst_start, n)), a) {
            i || (i = a.nodeMap[a.startNodeId].nextNodeMap.id);
            var s = a.opinionMap[i];
            s ? (this.scope.selectedOpinions = s, this.openOpinionFlow(e || s[s.length - 1], a)) : this.drawDynamicFlow(t)
          }
        }
      },
      openOpinionFlow: function (t, e) {
        var o = this.scope;
        o.selectedOpinion = t;
        var i, n, a;
        i = t.instId, n = t.taskId, a = t.taskName + t.trace;
        var s = baseService.postForm(__ctx + "/bpm/instance/getFlowImageInfo", {
          instanceId: i,
          defId: "",
          taskId: n
        });
        $.getResultData(s, (function (t) {
          t.nodeMap = e.nodeMap, t.flowLocation = e.flowLocation, o.subImageInfo = t;
          var i = new flowCanvas(o, e.startNodeId + "_flowImageCanvas", t, !0),
            n = i.initDraw();
          $("#flowImgModalTitle").text(a), $("#flowImgModal").modal("show"), $("#flowImgModalBody").html(i.canvas), n.drawFlowImage()
        }))
      },
      openCallActivity: function (t, e, o) {
        if (t && "CallActivity" == t.type && (!o || "subInst" == o)) {
          "subInst" != o && (window.hisSubFlow = window.hisSubFlow || [], window.hisSubFlow.push({
            scope: this,
            node: t,
            subInst: e,
            type: o
          }));
          var i = this.scope,
            n = t.id,
            a = "",
            s = "",
            r = "",
            l = "",
            h = t.subDefinition;
          h && (a = h.instanceId, s = h.id, r = h.taskId, l = h.name);
          var d = t.subInstanceList;
          if (d && d.length > 0) {
            var f = e;
            f || (f = d[d.length - 1]), this.scope.selectedSubInstanceList = d, this.scope.selectedSubInst = f, a = f.id, s = f.defId, r = f.taskId, l = f.defName
          }
          var c = baseService.postForm(__ctx + "/bpm/instance/getFlowImageInfo", {
            instanceId: a,
            defId: s,
            taskId: r
          });
          $.getResultData(c, (function (t) {
            i.subImageInfo = t;
            var e = new flowCanvas(i, n + "_flowImageCanvas", t, !0),
              o = e.initDraw();
            $("#flowImgModalTitle").text(l), $("#flowImgModal").modal("show"), $("#flowImgModalBody").html(e.canvas), o.drawFlowImage()
          }))
        }
      },
      drawDynamicFlow: function (t) {
        if (t && t.multInst) {
          this.scope;
          var e = t.id,
            o = {};
          o = "start" == t.multInst ? this.getFLowImageInfo(e, t.multInst_end) : this.getFLowImageInfo(t.multInst_start, e), this.scope.subImageInfo = o;
          var i = new flowCanvas(this.scope, e + "_flowImageCanvas", o, !0),
            n = i.initDraw();
          $("#flowImgModalTitle").text(n.imageInfo.flowElementJson[e].name + "-多实例分发流程图"), $("#flowImgModal").modal("show"), $("#flowImgModalBody").html(i.canvas), n.drawFlowImage()
        }
      },
      drawNode: function () {
        this.drawNodeFn(["subProcess", "callActivity", "pool", "lane"]), this.drawNodeFn(["startEvent", "endEvent", "textAnnotation", "serviceTask", "exclusiveGateway", "parallelGateway", "inclusiveGateway", "startTimer", "boundaryTimer", "catchTimer", "startSignal", "boundarySignal", "catchSignal", "throwSignal", "endError", "boundaryError", "endTerminate", "userTask", "mutiUserTask", "mutiInstTaskStart", "mutiInstTaskEnd", "dynamicTask"])
      },
      initTestNode: function () {
        this.imageInfo.nodeMap = [];
        var t = this.stackJson,
          e = {
            id: "UserTask1",
            x: 500,
            y: 500,
            width: 100,
            height: 80,
            nodeType: "userTask",
            nodeName: "驳回中心",
            color: "rgb(26, 179, 148)",
            type: "UserTask",
            nextNodeMap: o,
            preNodeMap: e
          },
          o = {
            id: "UserTask2",
            x: e.x - 300,
            y: e.y - 200,
            width: 100,
            height: 80,
            nodeType: "userTask",
            nodeName: "驳回到2",
            color: "rgb(26, 179, 148)",
            type: "UserTask",
            preNodeMap: e
          },
          i = {
            id: "UserTask3",
            x: e.x - 300,
            y: e.y - 200,
            width: 100,
            height: 80,
            nodeType: "userTask",
            nodeName: "驳回到3",
            color: "rgb(26, 179, 148)",
            type: "UserTask",
            preNodeMap: e
          },
          n = {
            id: "UserTask4",
            x: e.x + 300,
            y: e.y - 200,
            width: 100,
            height: 80,
            nodeType: "userTask",
            nodeName: "驳回到4",
            color: "rgb(26, 179, 148)",
            type: "UserTask",
            preNodeMap: e
          },
          a = {
            id: "UserTask5",
            x: e.x + 300,
            y: e.y + 200,
            width: 100,
            height: 80,
            nodeType: "userTask",
            nodeName: "驳回到5",
            color: "rgb(26, 179, 148)",
            type: "UserTask",
            preNodeMap: e
          },
          s = {
            id: "UserTask6",
            x: e.x + 300,
            y: e.y,
            width: 100,
            height: 80,
            nodeType: "userTask",
            nodeName: "驳回到6",
            color: "rgb(26, 179, 148)",
            type: "UserTask",
            preNodeMap: e
          },
          r = {
            id: "UserTask7",
            x: e.x - 300,
            y: e.y,
            width: 100,
            height: 80,
            nodeType: "userTask",
            nodeName: "驳回到7",
            color: "rgb(26, 179, 148)",
            type: "UserTask",
            preNodeMap: e
          },
          l = {
            id: "UserTask8",
            x: e.x,
            y: e.y + 200,
            width: 100,
            height: 80,
            nodeType: "userTask",
            nodeName: "驳回到8",
            color: "rgb(26, 179, 148)",
            type: "UserTask",
            preNodeMap: e
          },
          h = {
            id: "UserTask9",
            x: e.x,
            y: e.y - 200,
            width: 100,
            height: 80,
            nodeType: "userTask",
            nodeName: "驳回到9",
            color: "rgb(26, 179, 148)",
            type: "UserTask",
            preNodeMap: e
          },
          d = {
            id: "UserTask10",
            x: e.x - 300,
            y: e.y + 200,
            width: 100,
            height: 80,
            nodeType: "userTask",
            nodeName: "驳回到10",
            color: "rgb(26, 179, 148)",
            type: "UserTask",
            preNodeMap: e
          };
        t.back = {
          nodeName: e.id + "-》" + o.id,
          color: "rgb(0, 255, 0)"
        }, t.back1 = {
          nodeName: e.id + "-》" + i.id,
          color: "rgb(0, 255, 255)"
        }, t.back2 = {
          nodeName: e.id + "-》" + n.id,
          color: "rgb(255, 255, 255)"
        }, t.back3 = {
          nodeName: e.id + "-》" + a.id,
          color: "rgb(26, 179, 148)"
        }, t.back4 = {
          nodeName: e.id + "-》" + s.id,
          color: "rgb(26, 179, 148)"
        }, t.back5 = {
          nodeName: e.id + "-》" + r.id,
          color: "rgb(26, 179, 148)"
        }, t.back6 = {
          nodeName: e.id + "-》" + l.id,
          color: "rgb(26, 179, 148)"
        }, t.back7 = {
          nodeName: e.id + "-》" + h.id,
          color: "rgb(26, 179, 148)"
        }, t.back8 = {
          nodeName: e.id + "-》" + d.id,
          color: "rgb(26, 179, 148)"
        }, this.imageInfo.nodeMap[e.id] = e, this.imageInfo.nodeMap[o.id] = o, this.imageInfo.nodeMap[i.id] = i, this.imageInfo.nodeMap[n.id] = n, this.imageInfo.nodeMap[a.id] = a, this.imageInfo.nodeMap[s.id] = s, this.imageInfo.nodeMap[r.id] = r, this.imageInfo.nodeMap[l.id] = l, this.imageInfo.nodeMap[h.id] = h, this.imageInfo.nodeMap[d.id] = d
      },
      drawBohui: function () {
        for (var t = this.imageInfo.nodeMap, e = (this.nodeTypeJson, this.imageInfo.flowElementJson, this.imageInfo.opinionMap, this.nodeNameJson, this.imageInfo.stacks || []), o = (this.flowColorJson, this.flowLocation, this.xoffset), i = this.yoffset, n = 0; n < e.length; n++)
          if ("reject" == e[n].actionName && "back" == e[n].nodeId)
            for (var a = e[n], s = t[a.nodeName.split("-》")[0]], r = t[a.nodeName.split("-》")[1]], l = (s.x, s.y, s.width, s.height, r.x, r.y, r.width, r.height, this.getPointFromTwoBox(s, r)), h = 0; h < l.length - 1; h++) {
              var d = l[h],
                f = l[h + 1],
                c = new Arrow(d.x - o, d.y - i, f.x - o, f.y - i);
              c.setColor(Color.PINK), c.setDash(!0), h == l.length - 2 && c.setHead(!0), c.draw(this.cxt)
            }
      },
      drawBohui_back: function () {
        var t = this.imageInfo.nodeMap,
          e = (this.nodeTypeJson, this.imageInfo.flowElementJson, this.imageInfo.opinionMap, this.nodeNameJson, this.stackJson),
          o = (this.flowColorJson, this.flowLocation, this.xoffset),
          i = this.yoffset;
        for (var n in e)
          if ("back" == n) {
            var a = e[n],
              s = t[a.nodeName.split("-》")[0]],
              r = t[a.nodeName.split("-》")[1]],
              l = {
                x: s.x,
                y: s.y,
                w: s.width,
                h: s.height
              },
              h = {
                x: r.x,
                y: r.y,
                w: r.width,
                h: r.height
              },
              d = this.getMinDistancePoint([{
                x: l.x,
                y: l.y
              }, {
                x: l.x + l.w,
                y: l.y
              }, {
                x: l.x,
                y: l.y + l.h
              }, {
                x: l.x + l.w,
                y: l.y + l.h
              }], [{
                x: h.x,
                y: h.y
              }, {
                x: h.x + h.w,
                y: h.y
              }, {
                x: h.x,
                y: h.y + h.h
              }, {
                x: h.x + h.w,
                y: h.y + h.h
              }]),
              f = d.s,
              c = d.e,
              u = (this.getAngle(f.x, f.y, c.x, c.y), new Arrow(f.x - o, f.y - i, c.x - o, c.y - i));
            u.setColor(Color.PINK), u.setHead(!0), u.setDash(!0), u.draw(this.cxt);
            break
          }
      },
      drawDuoshili: function (t, e, o) {
        var i = this.imageInfo.flowLocation[t.flowElement.outgoingFlows[0].id],
          n = this.xoffset,
          a = this.yoffset,
          s = Color.success,
          r = i[0],
          l = i[1];
        this.drawTxt(r.x - n, r.y - a, l.x - n, l.y - a, o, s)
      },
      drawDuoshili_back2: function (t, e, o) {
        this.imageInfo.nodeMap, this.nodeTypeJson, this.imageInfo.flowElementJson, this.imageInfo.opinionMap, this.nodeNameJson;
        for (var i = this.stackJson, n = (this.flowColorJson, this.flowLocation, this.xoffset), a = this.yoffset, s = this.getPointFromTwoBox(t, e), r = 0; r < s.length - 1; r++) {
          var l = s[r],
            h = s[r + 1],
            d = new Arrow(l.x - n, l.y - a, h.x - n, h.y - a);
          d.setColor(i.color || Color.PINK), d.setDash(!0), r == s.length - 2 && d.setHead(!0), d.draw(this.cxt)
        }
        var f = Color.todo;
        l = s[1], h = s[2];
        this.drawTxt(l.x - n, l.y - a, h.x - n, h.y - a, o, f)
      },
      drawDuoshili_back: function (t, e, o) {
        this.imageInfo.nodeMap, this.nodeTypeJson, this.imageInfo.flowElementJson, this.imageInfo.opinionMap, this.nodeNameJson, this.stackJson, this.flowColorJson, this.flowLocation;
        var i = this.xoffset,
          n = this.yoffset,
          a = {
            x: t.x,
            y: t.y,
            w: t.width,
            h: t.height
          },
          s = {
            x: e.x,
            y: e.y,
            w: e.width,
            h: e.height
          },
          r = this.getMinDistancePoint([{
            x: a.x,
            y: a.y
          }, {
            x: a.x + a.w,
            y: a.y
          }, {
            x: a.x,
            y: a.y + a.h
          }, {
            x: a.x + a.w,
            y: a.y + a.h
          }], [{
            x: s.x,
            y: s.y
          }, {
            x: s.x + s.w,
            y: s.y
          }, {
            x: s.x,
            y: s.y + s.h
          }, {
            x: s.x + s.w,
            y: s.y + s.h
          }]),
          l = r.s,
          h = r.e,
          d = (this.getAngle(l.x, l.y, h.x, h.y), Color.todo),
          f = new Arrow(l.x - i, l.y - n, h.x - i, h.y - n);
        f.setColor(d), f.setHead(!0), f.setDash(!0), f.draw(this.cxt), this.drawTxt(l.x - i, l.y - n, h.x - i, h.y - n, o, d)
      },
      drawNodeFn: function (t) {
        var e = this.imageInfo.nodeMap,
          o = (this.nodeTypeJson, this.imageInfo.flowElementJson, this.imageInfo.opinionMap, this.nodeNameJson, this.stackJson),
          i = (this.flowColorJson, this.flowLocation, this.xoffset),
          n = this.yoffset;
        for (var a in e) {
          var s = e[a],
            r = s.nodeType,
            l = s.nodeName,
            h = s.flowElement,
            d = s.color;
          if (!(t.indexOf(r) < 0)) switch (this.drawLineTxt(i, n, h), r) {
            case "startEvent":
            case "endEvent":
              this.drawCircle(s.x - i, s.y - n, s.width, s.height, d, "", s.icon, s.reg), this.drawCircleTxt(s.x - i, s.y - n, s.width, s.height, d, l, s.icon);
              break;
            case "subProcess":
              this.drawSubProcess(s.x - i, s.y - n, s.width, s.height, l, "", d);
              break;
            case "callActivity":
              this.drawCallActivity(s.x - i, s.y - n, s.width, s.height, l, "", d);
              break;
            case "textAnnotation":
              this.drawTextAnnotation(s.x - i, s.y - n, s.width, s.height, l, d);
              break;
            case "serviceTask":
              this.drawTaskNode(s.x - i, s.y - n, s.width, s.height, l, "serviceIcon", d);
              break;
            case "exclusiveGateway":
              this.drawExclusiveGateway(s.x - i, s.y - n, l, d);
              break;
            case "parallelGateway":
              this.drawParallelGateway(s.x - i, s.y - n, l, d);
              break;
            case "inclusiveGateway":
              this.drawInclusiveGateway(s.x - i, s.y - n, l, d);
              break;
            case "startTimer":
            case "boundaryTimer":
            case "catchTimer":
              this.drawBoundaryTimer(s.x - i, s.y - n, s.width, s.height, d, l);
              break;
            case "startSignal":
            case "boundarySignal":
            case "catchSignal":
              this.drawStartSignalEvent(s.x - i, s.y - n, s.width, s.height, d, l);
              break;
            case "throwSignal":
              this.drawBoundarySignalEvent(s.x - i, s.y - n, s.width, s.height, d, l);
              break;
            case "endError":
              this.drawEndErrorEvent(s.x - i, s.y - n, s.width, s.height, d, l);
              break;
            case "boundaryError":
              this.drawBoundaryErrorEvent(s.x - i, s.y - n, s.width, s.height, d, l);
              break;
            case "endTerminate":
              this.drawEndTerminateEvent(s.x - i, s.y - n, s.width, s.height, d, l);
              break;
            case "pool":
            case "lane":
              s.hideDiv = !0, this.drawPool(s.x - i, s.y - n, s.width, s.height, l, "", d);
              break;
            case "mutiUserTask":
              this.drawTaskNode(s.x - i, s.y - n, s.width, s.height, l, "mutiUserIcon", d);
              break;
            case "mutiInstTaskStart":
              var f = [],
                c = {};
              if (s.nextNodeMap && s.nextNodeMap.opinions)
                for (a = 0; a < s.nextNodeMap.opinions.length; a++) {
                  var u = s.nextNodeMap.opinions[a].trace;
                  c[u] || (f.push(u), c[u] = !0)
                }
              f.length > 1 && this.drawDuoshili(s, s.nextNodeMap, f.length), this.drawTaskNode(s.x - i, s.y - n, s.width, s.height, l, "mutiInstIcon", d, -90);
              break;
            case "mutiInstTaskEnd":
              this.drawTaskNode(s.x - i, s.y - n, s.width, s.height, l, "mutiInstIcon", d, 90);
              break;
            case "dynamicTask":
              o[a] && "create" == o[a].actionName && (s.dynamicTaskCounts = o[a].nodeName.split("-")[o[a].nodeName.split("-").length - 1] + "/" + s.dynamicTaskCounts), this.drawDynamicNode(s.x - i, s.y - n, s.width, s.height, l, "dynamicTaskIcon", d, s.dynamicTaskCounts);
              break;
            case "userTask":
            default:
              this.drawTaskNode(s.x - i, s.y - n, s.width, s.height, l, "userIcon", d)
          }
        }
      },
      drawLine: function () {
        var t = this.flowLocation,
          e = this.xoffset,
          o = this.yoffset;
        for (var i in t) {
          this.stackJson[i];
          for (var n = t[i], a = this.flowColorJson[i] || this.Color.DEFAULT, s = 0; s < n.length - 1; s++) {
            var r = n[s],
              l = n[s + 1],
              h = new Arrow(r.x - e, r.y - o, l.x - e, l.y - o);
            h.setColor(a), s == n.length - 2 && h.setHead(!0), h.draw(this.cxt)
          }
        }
      },
      drawCircle: function (t, e, o, i, n, a, s, r) {
        var l = this.cxt,
          h = i / 2;
        if (l.beginPath(), l.moveTo(t + h, e), l.arcTo(t + o, e, t + o, e + i, h), l.arcTo(t + o, e + i, t, e + i, h), l.arcTo(t, e + i, t, e, h), l.arcTo(t, e, t + o, e, h), l.closePath(), l.strokeStyle = n || "black", l.lineWidth = a || 2, l.stroke(), s)
          if (l.fillStyle = n, document.getElementById(s) ? (s = document.getElementById(s).textContent, l.font = "bold 18px FontAwesome") : l.font = "bold 12px FontAwesome", r) {
            var d = t + 25,
              f = e + 10; - 90 == r ? (d = t + 20, f = e + 25) : 90 == r && (d = t + 10, f = e + 10);
            var c = r * Math.PI / 180;
            l.translate(d, f), l.rotate(c), l.fillText(s, 0, 0), l.rotate(-c), l.translate(-d, -f)
          } else l.fillText(s, t + 5, e + 19, 100)
      },
      drawCircleTxt: function (t, e, o, i, n, a, s) {
        if (a) {
          var r = this.cxt;
          r.font = "bold 12px 微软雅黑";
          var l = r.measureText(a).width;
          l = l / 2 - 18, r.fillStyle = n, r.fillText(a, t - l, e - 4, 100)
        }
      },
      drawIconCircle: function (t, e, o, i, n, a, s) {
        var r = this.cxt;
        this.drawCircle(t, e, o, i, n, 4), r.fillStyle = "#fff", r.fill(), r.font = "normal 26px FontAwesome", r.fillStyle = n;
        s = document.getElementById(s).textContent;
        r.fillText(s, t + 4, e + 24, 100), this.drawCircleTxt(t, e, o, i, n, a, s)
      },
      drawBoundaryTimer: function (t, e, o, i, n, a) {
        var s = this.cxt;
        this.drawCircle(t, e, o, i, n, 2), s.fillStyle = "#fff", s.fill(), s.font = "normal 26px FontAwesome", s.fillStyle = n;
        var r = document.getElementById("timerIcon").textContent;
        s.fillText(r, t + 4, e + 25, 100), this.drawCircleTxt(t, e, o, i, n, a, r)
      },
      drawStartSignalEvent: function (t, e, o, i, n, a) {
        var s = this.cxt;
        this.drawCircle(t, e, o, i, n, 4), s.fillStyle = "#fff", s.fill(), s.font = "normal 40px FontAwesome", s.fillStyle = n;
        var r = document.getElementById("upIcon").textContent;
        s.fillText(r, t + 4, e + 25, 100), this.drawCircleTxt(t, e, o, i, n, a, r)
      },
      drawEndErrorEvent: function (t, e, o, i, n, a) {
        var s = this.cxt;
        this.drawCircle(t, e, o, i, n, 4), s.fillStyle = "#fff", s.fill(), s.font = "normal 23px FontAwesome", s.fillStyle = n;
        var r = document.getElementById("endErrorIcon").textContent;
        s.fillText(r, t + 6, e + 23, 100), this.drawCircleTxt(t, e, o, i, n, a, r)
      },
      drawBoundaryErrorEvent: function (t, e, o, i, n, a) {
        var s = this.cxt;
        this.drawCircle(t, e, o, i, n, 4), s.fillStyle = "#fff", s.fill(), s.font = "normal 23px FontAwesome", s.fillStyle = n;
        var r = document.getElementById("boundaryErrorIcon").textContent;
        s.fillText(r, t + 9, e + 24, 100), this.drawCircleTxt(t, e, o, i, n, a, r)
      },
      drawEndTerminateEvent: function (t, e, o, i, n, a) {
        var s = this.cxt;
        this.drawCircle(t, e, o, i, n, 6), s.fillStyle = "#fff", s.fill(), s.font = "normal 26px FontAwesome", s.fillStyle = n;
        var r = document.getElementById("endIcon").textContent;
        s.fillText(r, t + 4, e + 24, 100), this.drawCircleTxt(t, e, o, i, n, a, r)
      },
      drawBoundarySignalEvent: function (t, e, o, i, n, a) {
        var s = this.cxt;
        this.drawCircle(t, e, o, i, n, 1);
        this.drawCircle(t + 4, e + 4, o - 8, i - 8, n, 1), s.fillStyle = "#fff", s.fill(), s.font = "normal 32px FontAwesome", s.fillStyle = n;
        var r = document.getElementById("upIcon").textContent;
        s.fillText(r, t + 6, e + 23, 100), this.drawCircleTxt(t, e, o, i, n, a, r)
      },
      drawRoundedRect: function (t, e, o) {
        var i = this.cxt;
        i.lineWidth = 1;
        var n = this.Point(t.x + o, t.y),
          a = this.Point(t.x + t.width, t.y),
          s = this.Point(t.x + t.width, t.y + t.height),
          r = this.Point(t.x, t.y + t.height),
          l = this.Point(t.x, t.y);
        i.beginPath(), i.moveTo(n.x, n.y), i.arcTo(a.x, a.y, s.x, s.y, o), i.arcTo(s.x, s.y, r.x, r.y, o), i.arcTo(r.x, r.y, l.x, l.y, o), i.arcTo(l.x, l.y, n.x, n.y, o), i.stroke()
      },
      drawPool: function (t, e, o, i, n, a, s) {
        var r = this.cxt;
        if (this.h = i, this.w = o, this.x = t, this.y = e, r.strokeStyle = s || "black", this.rect(t, e, o, i, s), n) {
          r.font = "bold 12px 微软雅黑";
          var l = -90 * Math.PI / 180,
            h = t + 15,
            d = e + i / 2;
          r.beginPath(), r.translate(h, d), r.rotate(l), r.fillStyle = s, r.strokeStyle = s, r.fillText(n, 0, 0), r.rotate(-l), r.translate(-h, -d), r.closePath(), r.stroke()
        }
      },
      rect: function (t, e, o, i, n) {
        var a = this.cxt;
        a.lineWidth = 1, a.strokeStyle = n || "black", a.strokeRect(t, e, o, i)
      },
      drawParallelGateway: function (t, e, o, i) {
        this.cxt;
        t += 20, e += 20, this.drawGateWay(t, e, 20, o, i), this.drawJia(t, e, 10, i)
      },
      drawInclusiveGateway: function (t, e, o, i) {
        this.cxt;
        var n = 20;
        t += n, e += n, this.drawGateWay(t, e, n, o, i), t -= 10, e -= 10, this.drawCircle(t, e, n, n, i, 2)
      },
      drawExclusiveGateway: function (t, e, o, i) {
        this.cxt;
        t += 20, e += 20, this.drawGateWay(t, e, 20, o, i), this.drawXX(t, e, 8, i)
      },
      drawGateWay: function (t, e, o, i, n) {
        var a = this.cxt;
        a.beginPath(), a.moveTo(t, e + o), a.lineTo(t - o, e), a.lineTo(t, e - o), a.lineTo(t + o, e), a.closePath(), a.fillStyle = n, a.strokeStyle = n, i && (a.font = "bold 12px 微软雅黑", a.fillText(i, t + o / 2, e + o, 100)), a.stroke()
      },
      drawSubProcess: function (t, e, o, i, n, a) {
        var s = this.cxt;
        this.h = i, this.w = o, this.x = t, this.y = e, s.strokeStyle = a || "black", s.fillStyle = a, n && (s.font = "bold 12px 微软雅黑", s.fillText(n, t + 10, e + 20, 100));
        var r = new this.Rect(t, e, this.w, this.h);
        this.drawRoundedRect(r, a, 5)
      },
      drawCallActivity: function (t, e, o, i, n, a, s) {
        var r = this.cxt;
        r.fillStyle = s, this.drawSubProcess(t, e, o, i, n, s), r.font = "bold 18px FontAwesome";
        a = document.getElementById("plusIcon").textContent;
        r.fillText(a, t + o / 2 - 8, e + i - 5, 100)
      },
      drawTextAnnotation: function (t, e, o, i, n, a) {
        var s = this.cxt,
          r = new Arrow(t, e, t, e + i);
        r.setColor(a), r.draw(s), (r = new Arrow(t, e, t + 20, e)).setColor(a), r.draw(s), (r = new Arrow(t, e + i, t + 20, e + i)).setColor(a), r.draw(s), n && (s.font = "bold 12px 微软雅黑", s.fillText(n, t + 10, e + i / 2, 100))
      },
      drawDynamicNode: function (t, e, o, i, n, a, s, r) {
        this.drawTaskNode(t, e, o, i, "", "", s);
        this.drawTaskNode(t + 3, e + 3, o, i, "", "", s), this.drawTaskNode(t + 6, e + 6, o, i, n, r || "dynamicTaskIcon", s)
      },
      drawXX: function (t, e, o, i) {
        var n, a = this.cxt,
          s = t - o,
          r = e - o,
          l = t + o,
          h = e + o;
        (n = new Arrow(s, r, l, h)).setColor(i), n.draw(a), (n = new Arrow(s, h, l, r)).setColor(i), n.draw(a)
      },
      drawJia: function (t, e, o, i) {
        var n, a = this.cxt;
        (n = new Arrow(t - o, e, t + o, e)).setColor(i), n.draw(a), (n = new Arrow(t, e - o, t, e + o)).setColor(i), n.draw(a)
      },
      hasDrawedLineId: {},
      drawLineTxt: function (t, e, o) {
        this.cxt;
        if (o) {
          var i = o.outgoingFlows || [],
            n = o.incomingFlows || [];
          i.pushAll(n);
          for (var a = 0; a < i.length; a++) {
            var s = i[a],
              r = s.name,
              l = s.id;
            if (l && !this.hasDrawedLineId[l]) {
              this.hasDrawedLineId[l] = !0;
              var h = this.flowLocation[l],
                d = h[0],
                f = h[1];
              if (r) {
                var c = this.flowColorJson[l] || this.Color.DEFAULT;
                this.drawTxt(d.x - t, d.y - e, f.x - t, f.y - e, r, c)
              }
            }
          }
        }
      },
      drawTxt: function (t, e, o, i, n, a) {
        var s = this.cxt,
          r = this.getAngle(t, e, o, i),
          l = s.measureText(n).width / 2,
          h = Math.abs(i - e) / 2,
          d = Math.abs(o - t) / 2,
          f = t,
          c = e;
        0 == r ? (f = t + d - l / 2 - 5, c = e - 5) : r > 0 && r < 90 ? (r = -r, f = t + d - l / 2 - 10, c = e - h - 5) : 90 == r ? (r = -r, f = t - 10, c = e - h + l / 2) : r > 90 && r <= 180 ? (r = 180 - r, f = o + d - l / 2 - 5, c = i + h - 10) : r > 180 && r < 270 ? (r = -(180 + r), f = t - d - l / 2, c = e + h + l / 2 - 10) : 270 == r ? (r = -(360 - r), f = o - 5, c = i - h + l / 2 + 5) : (r = 360 - r, f = t + d - l / 2 + 15, c = e + h - 5);
        var u = r * Math.PI / 180,
          g = f,
          w = c;
        s.beginPath(), s.translate(g, w), s.rotate(u), s.fillStyle = a, s.strokeStyle = a, s.font = "normal 12px FontAwesome", s.fillText(n, 0, 0), s.rotate(-u), s.translate(-g, -w), s.closePath(), s.stroke()
      },
      drawTaskNode: function (t, e, o, i, n, a, s, r) {
        var l = this.cxt;
        if (this.flag = "step", this.h = i, this.w = o, this.x = t, this.y = e, l.strokeStyle = s || "black", a)
          if (l.fillStyle = s, document.getElementById(a) ? (a = document.getElementById(a).textContent, l.font = "bold 18px FontAwesome") : l.font = "bold 12px FontAwesome", r) {
            var h = t + 25,
              d = e + 10; - 90 == r ? (h = t + 20, d = e + 25) : 90 == r && (h = t + 10, d = e + 10);
            var f = r * Math.PI / 180;
            l.translate(h, d), l.rotate(f), l.fillText(a, 0, 0), l.rotate(-f), l.translate(-h, -d)
          } else l.fillText(a, t + 5, e + 19, 100);
        if (n) {
          l.font = "bold 12px 微软雅黑";
          for (var c = n.split(""), u = "", g = [], w = 0; w < c.length; w++) l.measureText(u).width < o - 20 || (g.push(u), u = ""), u += c[w];
          if (g.push(u), g.length >= 2) {
            var y = 10;
            2 == g.length && (y = 3), g.length >= 3 && (y = 0);
            for (var x = 0; x < g.length; x++) {
              var p = (o - l.measureText(g[x]).width) / 2;
              l.fillText(g[x], t + p, e + i / 2 + y + 20 * x, 100)
            }
          } else {
            l.font = "bold 12px 微软雅黑";
            p = (o - l.measureText(n).width) / 2;
            l.fillText(n, t + p, e + i / 2 + 10, 100)
          }
        }
        var m = new this.Rect(t, e, this.w, this.h);
        this.drawRoundedRect(m, s, 5)
      },
      getAngle: function (t, e, o, i) {
        this.cxt;
        if (!(t - o) && !(e - i)) return 0;
        var n = Math.atan2(i - e, o - t);
        return (n = 180 * -n / Math.PI) < 0 && (n += 360), n
      },
      getPointFromTwoBox: function (t, e) {
        var o = {
            x: t.x + t.width / 2,
            y: t.y + t.height / 2
          },
          i = {
            x: e.x + e.width / 2,
            y: e.y + e.height / 2
          },
          n = 20,
          a = this.getAngle(o.x, o.y, i.x, i.y);
        if (a >= 0 && a < 90) {
          Math.abs(t.x - e.x);
          return (s = Math.abs(t.y - e.y)) > e.height + 30 ? (n = (s - e.height) / 2, [{
            x: t.x + t.width / 2,
            y: t.y
          }, {
            x: t.x + t.width / 2,
            y: t.y - n
          }, {
            x: e.x + e.width / 2,
            y: t.y - n
          }, {
            x: e.x + e.width / 2,
            y: e.y + e.height
          }]) : [{
            x: t.x + t.width / 2,
            y: t.y
          }, {
            x: t.x + t.width / 2,
            y: e.y - n
          }, {
            x: e.x + e.width / 2,
            y: e.y - n
          }, {
            x: e.x + e.width / 2,
            y: e.y
          }]
        }
        if (90 == a || 270 == a) return [{
          x: t.x + t.width,
          y: t.y + t.height / 2
        }, {
          x: t.x + t.width + n,
          y: t.y + t.height / 2
        }, {
          x: e.x + e.width + n,
          y: e.y + e.height / 2
        }, {
          x: e.x + e.width,
          y: e.y + e.height / 2
        }];
        if (a > 90 && a <= 180) {
          Math.abs(t.x - e.x);
          if ((s = Math.abs(t.y - e.y)) > e.height) {
            n = s / 2;
            return [{
              x: t.x + t.width / 2,
              y: t.y
            }, {
              x: t.x + t.width / 2,
              y: e.y + e.height / 2
            }, {
              x: e.x + e.width,
              y: e.y + e.height / 2
            }]
          }
          return [{
            x: t.x + t.width / 2,
            y: t.y
          }, {
            x: t.x + t.width / 2,
            y: e.y - n
          }, {
            x: e.x + e.width / 2,
            y: e.y - n
          }, {
            x: e.x + e.width / 2,
            y: e.y
          }]
        }
        if (a > 180 && a < 270) {
          Math.abs(t.x - e.x);
          return (s = Math.abs(t.y - e.y)) > t.height ? (n = (s - t.height) / 2, [{
            x: t.x + t.width / 2,
            y: t.y + t.height
          }, {
            x: t.x + t.width / 2,
            y: t.y + t.height + n
          }, {
            x: e.x + e.width / 2,
            y: t.y + t.height + n
          }, {
            x: e.x + e.width / 2,
            y: e.y
          }]) : [{
            x: t.x + t.width / 2,
            y: t.y + t.height
          }, {
            x: t.x + t.width / 2,
            y: e.y + e.height + n
          }, {
            x: e.x + e.width / 2,
            y: e.y + e.height + n
          }, {
            x: e.x + e.width / 2,
            y: e.y + e.height
          }]
        }
        if (a > 270 && a <= 360) {
          var s;
          Math.abs(t.x - e.x);
          return (s = Math.abs(t.y + t.height - e.y)) > 40 ? (n = s / 2, [{
            x: t.x + t.width / 2,
            y: t.y + t.height
          }, {
            x: t.x + t.width / 2,
            y: e.y - n
          }, {
            x: e.x + e.width / 2,
            y: e.y - n
          }, {
            x: e.x + e.width / 2,
            y: e.y
          }]) : [{
            x: t.x + t.width / 2,
            y: t.y + t.height
          }, {
            x: t.x + t.width / 2,
            y: e.y + e.height + n
          }, {
            x: e.x + e.width / 2,
            y: e.y + e.height + n
          }, {
            x: e.x + e.width / 2,
            y: e.y + e.height
          }]
        }
      },
      getMinDistancePoint: function (t, e) {
        for (var o = 1e6, i = "", n = "", a = 0; a < t.length; a++)
          for (var s = t[a], r = 0; r < e.length; r++) {
            var l = e[r],
              h = o;
            (o = Math.min(o, Math.sqrt(Math.pow(s.x - l.x, 2) + Math.pow(s.y - l.y, 2)))) < h && (i = s, n = l)
          }
        return {
          s: i,
          e: n
        }
      }
    }
  },
  112: function (module, exports) {
    window.flowCanvas = function (t, e, o, i) {
      for (var n in flowCanvasFn) this[n] = flowCanvasFn[n];
      this.id = e, this.scope = t, this.imageInfo = o, this.imageInfo.preId || (this.imageInfo.preId = GetRandomStr()), this.createCanvas = i
    }, window.flowCanvasFn = {
      initDraw: function () {
        this.initData(), this.initCanvas(), this.initDialogs();
        var t = new drawFlowImg(this);
        return this.imageInfo.flowFn = t, t
      },
      initData: function () {
        this.nodeMap = this.imageInfo.nodeMap, this.flowLocation = this.imageInfo.flowLocation, this.stacks = this.imageInfo.stacks || [], this.flowElements = this.imageInfo.flowElements, this.imageInfo.opinionMap = this.imageInfo.opinionMap || {}, this.opinionMap = this.imageInfo.opinionMap, this.xoffset = this.imageInfo.xoffset || -10, this.yoffset = this.imageInfo.yoffset || -25, this.domxoffset = this.xoffset, this.domyoffset = this.yoffset, this.createCanvas && (this.xoffset = -30, this.yoffset = -20, this.domxoffset = -55, this.domyoffset = -50), this.initFlowData(this.flowElements), this.initStatck(), this.initNodeInfo(), this.initNodeRelation(), this.initNodeOpitions(), this.initNodeType()
      },
      initCanvas: function () {
        if (this.canvas = document.getElementById(this.id), this.createCanvas) {
          var t = $('<canvas id="' + this.id + '"></canvas>');
          this.canvas = t[0]
        }
        this.cxt = this.canvas.getContext("2d"), this.ctx = this.cxt;
        var e = 1e4,
          o = 1e4,
          i = 0,
          n = 0;
        for (var a in this.nodeMap) {
          var s = this.nodeMap[a];
          e = Math.min(e, s.x), o = Math.min(o, s.y), i = Math.max(i, s.x + s.width), n = Math.max(n, s.y + s.height)
        }
        for (var a in this.flowLocation)
          for (var r = this.flowLocation[a], l = 0; l < r.length; l++) {
            var h = r[l];
            e = Math.min(e, h.x), o = Math.min(o, h.y), i = Math.max(i, h.x + h.width), n = Math.max(n, h.y + h.height)
          }
        this.canvas.width = i + e + 300, this.canvas.height = n + o + 200, this.cxt.fillStyle = "white", this.ctx.fillRect(0, 0, this.canvas.width, this.canvas.height)
      },
      initDialogs: function () {
        var t = {
            hide: {
              event: "mouseleave",
              leave: !1,
              fixed: !0,
              delay: 100
            },
            style: {
              classes: "qtip-default  qtip qtip-bootstrap qtip-shadow"
            }
          },
          e = this.imageInfo,
          o = this;
        window.setTimeout((function () {
          for (let i in e.opinionMap) o.createCanvas ? (t.content = {
            text: $("#" + e.preId + i)
          }, $("#subnode" + i).qtip(t)) : (t.content = {
            text: $("#" + i)
          }, $("#node" + i).qtip(t))
        }), 900)
      },
      initStatck: function () {
        for (var t = this.stacks, e = {}, o = {}, i = {}, n = 0; n < t.length; n++) {
          var a = t[n];
          e[a.nodeId] = a, o[a.nodeId] = a.nodeType;
          var s = a.actionName;
          "sequenceFlow" == a.nodeType && "create" == s && (s = "start"), i[a.nodeId] = this.getColor(s)
        }
        this.flowColorJson = i, this.nodeTypeJson = o, this.stackJson = e
      },
      initNodeInfo: function () {
        var imageInfo = this.imageInfo,
          pools = imageInfo.pools || [],
          lanes = imageInfo.lanes || [],
          artifacts = imageInfo.artifacts || [],
          boundaryEvents = imageInfo.boundaryEvents || [];
        pools.pushAll(lanes), pools.pushAll(artifacts), pools.pushAll(boundaryEvents);
        for (var nodeNameJson = {}, i = 0; i < pools.length; i++) {
          var p = pools[i];
          if (p.$ref) {
            var $ = {
              data: imageInfo
            };
            p = eval("(" + p.$ref + ")")
          }
          nodeNameJson[p.id] = p
        }
        this.nodeNameJson = nodeNameJson;
        var flowElementJson = this.imageInfo.flowElementJson,
          flowColorJson = this.flowColorJson,
          nodeMap = this.nodeMap;
        for (var i in nodeMap) {
          var xyz = nodeMap[i];
          xyz.id = i;
          var flowElement = flowElementJson[i] || nodeNameJson[i] || flowElementJson[xyz.oldId],
            nodeName = flowElement.name || flowElement.text;
          xyz.nodeName = nodeName, xyz.flowElement = flowElement;
          var color = flowColorJson[i] || this.Color.DEFAULT;
          xyz.color = color, xyz.domxoffset = this.domxoffset, xyz.domyoffset = this.domyoffset
        }
      },
      initFlowData: function (t) {
        if (t)
          for (var e = this.imageInfo, o = e.flowElementJson || {}, i = e.boundaryEvents || [], n = 0; n < t.length; n++) {
            var a = t[n];
            o[a.id] = a, i.pushAll(a.boundaryEvents || []), e.boundaryEvents = i, e.flowElementJson = o;
            var s = a.flowElements;
            s && s.length > 0 && this.initFlowData(s)
          }
      },
      nodeTypeMap: {
        BoundaryEvent: "boundaryTimer",
        IntermediateCatchEvent: "catchSignal",
        EndEvent: "endEvent",
        EndEvent1: "endEvent",
        ExclusiveGateway: "exclusiveGateway",
        ParallelGateway: "parallelGateway",
        StartEvent: "startEvent",
        ThrowEvent: "throwSignal",
        UserTask: "userTask",
        ScriptTask: "serviceTask",
        InclusiveGateway: "inclusiveGateway"
      },
      getNodeType: function (t, e) {
        var o = "";
        return e.indexOf("Pool") >= 0 && (o = "pool"), e.indexOf("Lane") >= 0 && (o = "lane"), e.indexOf("StartNoneEvent") >= 0 && (o = "startEvent"), e.indexOf("TextAnnotation") >= 0 && (o = "textAnnotation"), e.indexOf("EndNoneEvent") >= 0 && (o = "endEvent"), e.indexOf("SubProcess") >= 0 && (o = "subProcess"), e.indexOf("CallActivity") >= 0 && (o = "callActivity"), e.indexOf("UserTask") >= 0 && (o = "userTask"), e.indexOf("ServiceTask") >= 0 && (o = "serviceTask"), e.indexOf("ExclusiveGateway") >= 0 && (o = "exclusiveGateway"), e.indexOf("ParallelGateway") >= 0 && (o = "parallelGateway"), e.indexOf("InclusiveGateway") >= 0 && (o = "inclusiveGateway"), e.indexOf("StartTimer") >= 0 && (o = "startTimer"), e.indexOf("BoundaryTimer") >= 0 && (o = "boundaryTimer"), e.indexOf("CatchTimer") >= 0 && (o = "catchTimer"), e.indexOf("StartSignal") >= 0 && (o = "startSignal"), e.indexOf("BoundarySignal") >= 0 && (o = "boundarySignal"), e.indexOf("CatchSignal") >= 0 && (o = "catchSignal"), e.indexOf("ThrowSignal") >= 0 && (o = "throwSignal"), e.indexOf("EndError") >= 0 && (o = "endError"), e.indexOf("BoundaryError") >= 0 && (o = "boundaryError"), e.indexOf("EndTerminate") >= 0 && (o = "endTerminate"), o || (this.nodeTypeMap[t] || t)
      },
      getColor: function (t) {
        var e = this.Color;
        if (!t) return e.GREEN;
        switch (t) {
          case "start":
            return e.success;
          case "default":
            return e.DEFAULT;
          case "agree":
          case "signAgree":
            return e.success;
          case "oppose":
          case "signOppose":
          case "reject":
          case "reject2Start":
          case "recover":
            return e.PINK;
          case "dispense":
            return e.BLUE;
          case "manualEnd":
          case "recall":
            return e.DARK_GRAY;
          case "create":
            return e.todo;
          case "end":
            return e.success;
          case "taskCancelled":
            return e.cancelled;
          default:
            return e.RED
        }
      },
      initNodeType: function () {
        var t = this.imageInfo.nodeMap,
          e = this.nodeTypeJson;
        for (var o in t) {
          var i = t[o],
            n = i.type || e[o];
          n = this.getNodeType(n, o), 1 == i.signTask && (n = "mutiUserTask"), "start" == i.multInst && (n = "mutiInstTaskStart"), "end" == i.multInst && (n = "mutiInstTaskEnd"), "1" == i.dynamicTask && (n = "dynamicTask"), i.nodeType = n
        }
      },
      initNodeOpitions: function () {
        var t = this.imageInfo.nodeMap,
          e = this.opinionMap;
        for (var o in t) {
          var i = e[o] || [];
          t[o].opinions = i;
          for (var n = 0; n < i.length; n++) i[n].node = t[o]
        }
      },
      initNodeRelation: function () {
        var imageInfo = this.imageInfo;
        if (!this.createCanvas) {
          var flowElementJson = this.imageInfo.flowElementJson,
            flowElements = this.imageInfo.flowElements,
            nodeMap = this.imageInfo.nodeMap,
            flowLocation = this.flowLocation,
            newNodeMap = {},
            newFlowLocation = {},
            startNodeId = flowElements[0].id,
            startNode = flowElementJson[startNodeId];
          newNodeMap[startNodeId] = angular.copy(nodeMap[startNodeId]);
          var hasFilterFirstLine = !0,
            startNodeMap = newNodeMap[startNodeId],
            tempCurrentNodeMap = startNodeMap,
            deep = 0,
            loadedIdList = [];
          for (var i in getNextNodeAndLines(startNode), imageInfo.nodeMap) newNodeMap[i] && (imageInfo.nodeMap[i] = newNodeMap[i]);
          imageInfo.flowLocation = newFlowLocation
        }

        function getNextNodeAndLines(node) {
          if (!(loadedIdList.indexOf(node.id) >= 0))
            if (loadedIdList.push(node.id), deep++ > 200) console.error("有问题啦,可能是无限递归");
            else {
              var outgoingFlows = node.outgoingFlows || [];
              if (0 != outgoingFlows.length)
                for (var i = 0; i < outgoingFlows.length; i++) {
                  var outgoingFlow = outgoingFlows[i],
                    id = outgoingFlow.id;
                  if (!id) {
                    var $ = {
                      data: imageInfo
                    };
                    outgoingFlow = eval("(" + outgoingFlow.$ref + ")"), id = outgoingFlow.id
                  }
                  var outgoingFlowNode = flowElementJson[id];
                  if (outgoingFlow.targetRef != node.id && outgoingFlow.targetRef != node.oldId) {
                    outgoingFlowNode && "SequenceFlow" != outgoingFlowNode.type || (hasFilterFirstLine ? newFlowLocation[id] = angular.copy(flowLocation[id]) : hasFilterFirstLine = !0, id = outgoingFlow.targetRef, outgoingFlowNode = flowElementJson[outgoingFlow.targetRef]), newNodeMap[id] = angular.copy(nodeMap[id]), tempCurrentNodeMap.nextNodeMap = newNodeMap[id], newNodeMap[id].preNodeMap = tempCurrentNodeMap, tempCurrentNodeMap = newNodeMap[id];
                    var hasEndNode = !1;
                    if ("SubProcess" == newNodeMap[id].type) {
                      function getSubProcessNodes(t) {
                        if (t && 0 != t.length) {
                          var e = t,
                            o = e[0].id;
                          newNodeMap[o] = angular.copy(nodeMap[o]), tempCurrentNodeMap.nextNodeMap || (tempCurrentNodeMap.nextNodeMap = newNodeMap[o], newNodeMap[o].preNodeMap = tempCurrentNodeMap, tempCurrentNodeMap = newNodeMap[o]);
                          for (var i = 0; i < e.length; i++)
                            if (e[i].id) {
                              var n = e[i].id,
                                a = "SubProcess" == nodeMap[n].type;
                              !a && !nodeMap[n].type && n.indexOf("SubProcess") >= 0 && (a = !0), a && getSubProcessNodes(e[i].flowElements), getNextNodeAndLines(e[i])
                            }
                        }
                      }
                      getSubProcessNodes(outgoingFlowNode.flowElements)
                    }
                    getNextNodeAndLines(outgoingFlowNode)
                  }
                }
            }
        }
      },
      getFLowImageInfo: function (startNodeId, endNodeId) {
        var imageInfo = this.imageInfo,
          flowElementJson = this.imageInfo.flowElementJson,
          nodeMap = this.imageInfo.nodeMap,
          flowLocation = this.flowLocation;
        if (!nodeMap[startNodeId]) {
          var hasNode = !1;
          for (var i in nodeMap)
            if (nodeMap[i].oldId == startNodeId) {
              hasNode = !0, startNodeId = nodeMap[i].id;
              break
            } if (!hasNode) return void console.error("找不到开始节点信息:" + startNodeId)
        }
        if (nodeMap[endNodeId]) {
          var newNodeMap = {},
            newFlowLocation = {},
            startNode = flowElementJson[startNodeId];
          newNodeMap[startNodeId] = angular.copy(nodeMap[startNodeId]), newNodeMap[startNodeId].type = "StartEvent", startNode.type = "StartEvent", newNodeMap[startNodeId].icon = "mutiInstIcon", newNodeMap[startNodeId].reg = -90;
          var tempStartNodeId = "StartNoneEvent_muti";
          startNode.id = tempStartNodeId, newNodeMap[startNodeId].id = tempStartNodeId, newNodeMap[tempStartNodeId] = newNodeMap[startNodeId];
          var startNodeMap = newNodeMap[tempStartNodeId];
          startNodeMap.multInst = "", startNodeMap.multInst_end = "", startNodeMap.oldId = startNodeId;
          var oldW = startNodeMap.width,
            oldH = startNodeMap.height;
          startNodeMap.width = 30, startNodeMap.height = 30, startNodeMap.x = startNodeMap.x + oldW / 2 + 20, startNodeMap.y = startNodeMap.y + oldH / 2 + this.yoffset, startNode.oldId = startNodeId, delete newNodeMap[startNodeId];
          var hasFilterFirstLine = !0,
            isFirstLine = !1;
          getNextNodeAndLines(startNode);
          var imageInfo = {};
          for (var i in this.imageInfo) "flowFn" != i && (imageInfo[i] = angular.copy(this.imageInfo[i]));
          return imageInfo.nodeMap = newNodeMap, imageInfo.flowLocation = newFlowLocation, imageInfo.startNodeId = tempStartNodeId, imageInfo.flowElementJson = flowElementJson, imageInfo
        }

        function getNextNodeAndLines(node) {
          for (var outgoingFlows = node.outgoingFlows || [], hasEnd = !1, i = 0; i < outgoingFlows.length; i++) {
            var outgoingFlow = outgoingFlows[i],
              id = outgoingFlow.id,
              outgoingFlowNode = flowElementJson[id];
            if (outgoingFlow.targetRef == endNodeId) {
              hasEnd = !0;
              break
            }
          }
          for (var i = 0; i < outgoingFlows.length; i++) {
            var outgoingFlow = outgoingFlows[i],
              id = outgoingFlow.id;
            if (!id) {
              var $ = {
                data: imageInfo
              };
              outgoingFlow = eval("(" + outgoingFlow.$ref + ")"), id = outgoingFlow.id
            }
            var outgoingFlowNode = flowElementJson[id];
            if (!(outgoingFlow.targetRef == node.id || outgoingFlow.targetRef == node.oldId || hasEnd && outgoingFlow.targetRef != endNodeId)) {
              outgoingFlowNode && "SequenceFlow" != outgoingFlowNode.type || (isFirstLine || (isFirstLine = !0, startNodeMap.x = flowLocation[id][0].x - startNodeMap.width + 3, startNodeMap.y = flowLocation[id][0].y - startNodeMap.height + 3), hasFilterFirstLine ? newFlowLocation[id] = angular.copy(flowLocation[id]) : hasFilterFirstLine = !0, id = outgoingFlow.targetRef, outgoingFlowNode = flowElementJson[outgoingFlow.targetRef]), newNodeMap[id] = angular.copy(nodeMap[id]);
              var hasEndNode = !1;
              if ("SubProcess" == newNodeMap[id].type) {
                function getSubProcessNodes(t) {
                  if (t && 0 != t.length) {
                    var e = t,
                      o = e[0].id;
                    newNodeMap[o] = angular.copy(nodeMap[o]);
                    for (var i = 0; i < e.length; i++)
                      if (e[i].id) {
                        var n = e[i].id,
                          a = "SubProcess" == nodeMap[n].type;
                        if (!a && !nodeMap[n].type && n.indexOf("SubProcess") >= 0 && (a = !0), n == endNodeId) return hasEndNode = !0;
                        if (a)
                          if (getSubProcessNodes(e[i].flowElements)) return !0;
                        getNextNodeAndLines(e[i])
                      }
                  }
                }
                getSubProcessNodes(outgoingFlowNode.flowElements)
              }
              id == endNodeId || hasEndNode || getNextNodeAndLines(outgoingFlowNode)
            }
          }
        }
        console.error("找不到结束节点信息:" + endNodeId)
      },
      Point: function (t, e) {
        return {
          x: t,
          y: e
        }
      },
      Rect: function (t, e, o, i) {
        return {
          x: t,
          y: e,
          w: o,
          h: i,
          width: o,
          height: i
        }
      },
      Color: {
        GREEN: "rgb(0, 255, 0)",
        success: "rgb(26, 179, 148)",
        PINK: "rgb(255, 153, 0)",
        BLUE: "rgb(0, 0, 255)",
        DARK_GRAY: "rgb(64, 64, 64)",
        todo: "rgb(237, 85, 101)",
        cancelled: "rgb(28, 132, 198)",
        RED: "rgb(255, 0, 0)",
        DEFAULT: "rgb(103, 106, 108)"
      },
      closeFlow: function () {
        if (window.hisSubFlow && 0 != window.hisSubFlow.length) {
          if (window.hisSubFlow.length > 1) {
            var t = window.hisSubFlow[window.hisSubFlow.length - 2];
            t.scope.openCallActivity(t.node, t.subInst, t.type), window.hisSubFlow.splice(window.hisSubFlow.length - 1, 1)
          }
          window.hisSubFlow.splice(window.hisSubFlow.length - 1, 1)
        }
      }
    }
  },
  113: function (t, e) {
    function o(t, e) {
      this.flag = "condition", this.l = 30, this.x = t, this.y = e,
        function (t, e, o, i, n) {
          cxt.beginPath(), cxt.moveTo(t, e + o), cxt.lineTo(t - 2 * o, e), cxt.lineTo(t, e - o), cxt.lineTo(t + 2 * o, e), cxt.closePath(), cxt.fillStyle = n, i && (cxt.font = "bold 12px 微软雅黑", cxt.fillText(i, t + o / 2, e + o, 100)), cxt.stroke()
        }(t, e, this.l)
    }
    o.prototype.drawBottomToTop = function (t) {
      if ("step" == t.flag) new Arrow(this.x, this.y + this.l, t.x, t.y - t.h / 2).drawBottomToTop(cxt);
      else if ("condition" == t.flag) {
        new Arrow(this.x, this.y + this.l, t.x, t.y - t.l).drawBottomToTop(cxt)
      }
    }, o.prototype.drawRightToTop = function (t) {
      if ("step" == t.flag) new Arrow(this.x + 2 * this.l, this.y, t.x, t.y - t.h / 2).drawLeftOrRightToTop(cxt);
      else if ("condition" == t.flag) {
        new Arrow(this.x + 2 * this.l, this.y, t.x, t.y - t.l).drawLeftOrRightToTop(cxt)
      }
    }, o.prototype.drawLeftToTop = function (t) {
      if ("step" == t.flag) new Arrow(this.x - 2 * this.l, this.y, t.x, t.y - t.h / 2).drawLeftOrRightToTop(cxt);
      else if ("condition" == t.flag) {
        new Arrow(this.x - 2 * this.l, this.y, t.x, t.y - t.l).drawLeftOrRightToTop(cxt)
      }
    }, o.prototype.drawRightToLeft = function (t) {
      if ("step" == t.flag) new Arrow(this.x + 2 * this.l, this.y, t.x - this.w / 2, t.y).drawLeftToRightOrRightToLeft(cxt);
      else if ("condition" == t.flag) {
        new Arrow(this.x + 2 * this.l, this.y, t.x - 2 * this.l, t.y).drawLeftToRightOrRightToLeft(cxt)
      }
    }, o.prototype.drawLeftToRight = function (t) {
      if ("step" == t.flag) new Arrow(this.x - 2 * this.l, this.y, t.x + this.w / 2, t.y).drawLeftToRightOrRightToLeft(cxt);
      else if ("condition" == t.flag) {
        new Arrow(this.x - 2 * this.l, this.y, t.x + 2 * this.l, t.y).drawLeftToRightOrRightToLeft(cxt)
      }
    }
  },
  114: function (module, exports) {
    function getOpinionColar(t) {
      if (!t) return Color.GREEN;
      switch (t) {
        case "start":
        case "agree":
        case "signAgree":
          return Color.success;
        case "oppose":
        case "signOppose":
        case "reject":
        case "reject2Start":
        case "recover":
          return Color.PINK;
        case "dispense":
          return Color.BLUE;
        case "manualEnd":
        case "recall":
          return Color.DARK_GRAY;
        case "create":
          return Color.todo;
        case "end":
          return Color.success;
        case "taskCancelled":
          return Color.cancelled;
        default:
          return Color.RED
      }
    }
    window.initCanvas = function (imageInfo) {
      var canvas = document.getElementById("flowImageCanvas"),
        nodeMap = imageInfo.nodeMap,
        flowLocation = imageInfo.flowLocation,
        stacks = imageInfo.stacks || [],
        minX = 1e4,
        minY = 1e4,
        maxX = 0,
        maxY = 0;
      for (var i in nodeMap) {
        var xyz = nodeMap[i];
        minX = Math.min(minX, xyz.x), minY = Math.min(minY, xyz.y), maxX = Math.max(maxX, xyz.x + xyz.width), maxY = Math.max(maxY, xyz.y + xyz.height)
      }
      for (var i in flowLocation)
        for (var flows = flowLocation[i], j = 0; j < flows.length; j++) {
          var flowFrom = flows[j];
          minX = Math.min(minX, flowFrom.x), minY = Math.min(minY, flowFrom.y), maxX = Math.max(maxX, flowFrom.x + flowFrom.width), maxY = Math.max(maxY, flowFrom.y + flowFrom.height)
        }
      canvas.width = maxX + minX + 20, canvas.height = maxY + minY + 20, window.canvas = canvas, window.cxt = canvas.getContext("2d"), window.ctx = window.cxt, cxt.fillStyle = "white", ctx.fillRect(0, 0, canvas.width, canvas.height);
      var flowElements = imageInfo.flowElements;
      getFlowElementsJson(flowElements, imageInfo);
      var flowElementJson = imageInfo.flowElementJson,
        pools = imageInfo.pools || [],
        lanes = imageInfo.lanes || [],
        artifacts = imageInfo.artifacts || [],
        boundaryEvents = imageInfo.boundaryEvents || [];
      pools.pushAll(lanes), pools.pushAll(artifacts), pools.pushAll(boundaryEvents);
      for (var nodeNameJson = {}, i = 0; i < pools.length; i++) {
        var p = pools[i];
        if (p.$ref) {
          var $ = {
            data: imageInfo
          };
          p = eval("(" + p.$ref + ")")
        }
        nodeNameJson[p.id] = p
      }
      for (var stackJson = {}, nodeTypeJson = {}, flowColorMap = {}, stackColorJson = {}, gateColorMap = {}, nodeColorMap = {}, i = 0; i < stacks.length; i++) {
        var stack = stacks[i];
        stackJson[stack.nodeId] = stack, nodeTypeJson[stack.nodeId] = stack.nodeType;
        var actionName = stack.actionName;
        stackColorJson[stack.nodeId] = getOpinionColar(actionName), "sequenceFlow" == stack.nodeType ? ("create" == actionName && (actionName = "start"), flowColorMap[stack.nodeId] = getOpinionColar(actionName)) : "exclusiveGateway" == stack.nodeType ? gateColorMap[stack.nodeId] = getOpinionColar(actionName) : nodeColorMap[stack.nodeId] = getOpinionColar(actionName)
      }
      for (var i in nodeMap) {
        var xyz = nodeMap[i],
          nodeType = xyz.type || nodeTypeJson[i],
          flowElement = flowElementJson[i] || nodeNameJson[i],
          stack = stackJson[i] || {
            nodeName: flowElement.name || flowElement.text
          },
          color = nodeColorMap[i] || stackColorJson[i] || Color.DEFAULT,
          xoffset = 3,
          yoffset = -15;
        switch (nodeType = getNodeType(nodeType, i), nodeType) {
          case "startEvent":
          case "endEvent":
            drawCircle(xyz.x - xoffset, xyz.y - yoffset, xyz.width, xyz.height, color);
            break;
          case "subProcess":
            drawSubProcess(xyz.x - xoffset, xyz.y - yoffset, xyz.width, xyz.height, stack.nodeName, "", color);
            break;
          case "callActivity":
            drawCallActivity(xyz.x - xoffset, xyz.y - yoffset, xyz.width, xyz.height, stack.nodeName, "", color);
            break;
          case "textAnnotation":
            drawTextAnnotation(xyz.x - xoffset, xyz.y - yoffset, xyz.width, xyz.height, stack.nodeName, color);
            break;
          case "serviceTask":
            new Step(xyz.x - xoffset, xyz.y - yoffset, xyz.width, xyz.height, stack.nodeName, "serviceIcon", color);
            break;
          case "exclusiveGateway":
            drawExclusiveGateway(xyz.x - xoffset, xyz.y - yoffset, stack.nodeName, color);
            break;
          case "parallelGateway":
            drawParallelGateway(xyz.x - xoffset, xyz.y - yoffset, stack.nodeName, color);
            break;
          case "inclusiveGateway":
            drawInclusiveGateway(xyz.x - xoffset, xyz.y - yoffset, stack.nodeName, color);
            break;
          case "startTimer":
          case "boundaryTimer":
          case "catchTimer":
            drawBoundaryTimer(xyz.x - xoffset, xyz.y - yoffset, xyz.width, xyz.height, color, stack.nodeName);
            break;
          case "startSignal":
          case "boundarySignal":
          case "catchSignal":
            drawStartSignalEvent(xyz.x - xoffset, xyz.y - yoffset, xyz.width, xyz.height, color, stack.nodeName);
            break;
          case "throwSignal":
            drawBoundarySignalEvent(xyz.x - xoffset, xyz.y - yoffset, xyz.width, xyz.height, color, stack.nodeName);
            break;
          case "endError":
            drawEndErrorEvent(xyz.x - xoffset, xyz.y - yoffset, xyz.width, xyz.height, color, stack.nodeName);
            break;
          case "boundaryError":
            drawBoundaryErrorEvent(xyz.x - xoffset, xyz.y - yoffset, xyz.width, xyz.height, color, stack.nodeName);
            break;
          case "endTerminate":
            drawEndTerminateEvent(xyz.x - xoffset, xyz.y - yoffset, xyz.width, xyz.height, color, stack.nodeName);
            break;
          case "pool":
          case "lane":
            drawPool(xyz.x - xoffset, xyz.y - yoffset, xyz.width, xyz.height, stack.nodeName, "", color);
            break;
          case "userTask":
          default:
            new Step(xyz.x - xoffset, xyz.y - yoffset, xyz.width, xyz.height, stack.nodeName, "userIcon", color)
        }
        draLineTxt(xoffset, yoffset, flowElement, flowLocation, stackColorJson)
      }
      for (var i in flowLocation)
        for (var stack = stackJson[i], flows = flowLocation[i], color = flowColorMap[i] || Color.DEFAULT, j = 0; j < flows.length - 1; j++) {
          var flowFrom = flows[j],
            flowTo = flows[j + 1],
            arrow = new Arrow(flowFrom.x - xoffset, flowFrom.y - yoffset, flowTo.x - xoffset, flowTo.y - yoffset);
          arrow.setColor(color), j == flows.length - 2 && arrow.setHead(!0), arrow.draw(ctx)
        }
    }, window.Color = {
      GREEN: "rgb(0, 255, 0)",
      success: "rgb(26, 179, 148)",
      PINK: "rgb(255, 175, 175)",
      BLUE: "rgb(0, 0, 255)",
      DARK_GRAY: "rgb(64, 64, 64)",
      todo: "rgb(237, 85, 101)",
      cancelled: "rgb(28, 132, 198)",
      RED: "rgb(255, 0, 0)",
      DEFAULT: "rgb(103, 106, 108)"
    }
  }
});
